Telerik Forums
UI for WPF Forum
2 answers
364 views
Hi,

I have an application that when the user close the window, I'd like to do some time consuming task (update database). At the same time, I want to show busy indicator. When the task is done, close the window as per normal. Here's the sample code
public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
            Closing += MainWindowClosing;
        }
 
        void MainWindowClosing(object sender, CancelEventArgs e)
        {
            e.Cancel = true;
            busyIndicator.IsBusy = true;
            var worker = new BackgroundWorker();
            worker.DoWork += (s, args) => Thread.Sleep(TimeSpan.FromSeconds(3));//just for testing
            worker.RunWorkerCompleted += (s, args) =>
                                             {
                                                 busyIndicator.IsBusy = false;
                                                 e.Cancel = false;
                                             };
            worker.RunWorkerAsync();
 
        }
    }

but it's not working. The "e.Cancel = false" doesn't close the window. Can anyone help? Where did I do wrong?

Thanks!
Konstantina
Telerik team
 answered on 25 Jul 2011
1 answer
181 views
I am trying to create a chart very similar to the Live Data chart in the examples.  When my timer runs the data is updated but not shown on the chart.  However, if I break into the timer event and look at some values in the debugger and then eventually tell the app to start running again then I sometimes will see some of the data drawn on the chart but it still does not update in real time.

We are using the latest WPF controls.

PS:  Apparently we can longer attach files?

A sample project can be found here:   sample project
Ves
Telerik team
 answered on 25 Jul 2011
3 answers
112 views
I have a RadGridView that is part of a datatemplate that I am creating at runtime via c#. All is good if I AutoGenerate the columns. If I try to create the GridViewDataColumns I have no way of adding them. Seems the Columns property is not exposed as a dependency property. Can you please look into this and suggest a work around or possible solution? In my example, RadGridView.Columns does not appear to be accessible.
FrameworkElementFactory radGridView = new FrameworkElementFactory(typeof(RadGridView));
radGridView.SetValue(RadGridView.ShowGroupPanelProperty,false);
radGridView.SetValue(RadGridView.ShowInsertRowProperty, false);
 
Telerik.Windows.Controls.GridViewColumnCollection colCollection = new Telerik.Windows.Controls.GridViewColumnCollection();
 
GridViewDataColumn dc = new GridViewDataColumn();
dc.Header = "test"
 
colCollection.Add(dc);
radGridView.SetValue(RadGridView.Columns,colCollection);

Ivan Ivanov
Telerik team
 answered on 25 Jul 2011
1 answer
109 views
How could I make the RadRadioButton show as the tranditional radio button? I don't want to use the RadioButton since I need to use the ICommand feature
Dani
Telerik team
 answered on 25 Jul 2011
3 answers
291 views
I'd like to have the footer cells' content be horizontally centered within the cells.  How can this be achieved?

I've tried the following:

<telerik:GridViewDataColumn DataMemberBinding="{Binding HubAssemblyNumber}"
                            FooterCellStyle="{StaticResource GridViewFooterCellStyle1}">
    <telerik:GridViewDataColumn.Header>
        <TextBlock Style="{StaticResource centeredHeaderTextBoxStyle}">
            <TextBlock.Inlines>
                <Run>Assembly</Run>
                <LineBreak />
                <Run>Number</Run>
            </TextBlock.Inlines>
        </TextBlock>
    </telerik:GridViewDataColumn.Header>
    <telerik:GridViewDataColumn.AggregateFunctions>
        <telerik:CountFunction Caption="Count: "
                                ResultFormatString="{StaticResource commaFormat}" />
    </telerik:GridViewDataColumn.AggregateFunctions>
 
    <telerik:GridViewDataColumn.Footer>
        <telerik:AggregateResultsList ItemsSource="{Binding}"
                                        HorizontalAlignment="Center"
                                        HorizontalContentAlignment="Center" >
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock HorizontalAlignment="Center"
                                Text="{Binding FormattedValue}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid HorizontalAlignment="Center" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </telerik:AggregateResultsList>
    </telerik:GridViewDataColumn.Footer>
 
</telerik:GridViewDataColumn>

And I've tried it both with and without a custom footer style:

<Style x:Key="GridViewFooterCellStyle1"
        TargetType="{x:Type telerik:GridViewFooterCell}">
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:GridViewFooterCell}">
                <Border x:Name="PART_FooterCellBorder"
                    <ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}"
                                        Content="{TemplateBinding Content}"
                                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="HorizontalContentAlignment"
            Value="Center" />
    <Setter Property="HorizontalAlignment"
            Value="Stretch" />
</Style>

Moreover, I've tweaked the various Horizontal[Content]Alignment properties.  But so far my fiddling hasn't yielded the desired behavior.

I appreciate the help.  Thanks!
Miles
Top achievements
Rank 1
 answered on 25 Jul 2011
1 answer
86 views
Hi,

we updated from Q1 to Q2 .dlls and experienced a major problem with the grids.
Here the description:
We have a Grid with bound Itemssource etc. A very normal scenario.

When the user tabs through the RadRibbon, the Gridview seems to break the binding.

This can be best seen in the sample projects I will attach. To see the issue:
UPDATE: Where can I attach .zip files???

On the main tab enter a value in the textbox -> updates all the values in the grid as intended.
Now, switch to the empty tab, and then switch back and enter values again -> does not work anymore

With the Q1 .dlls it works, for the Q2 it does not.

Maya
Telerik team
 answered on 25 Jul 2011
1 answer
152 views
I'm investigating RadControls for WPF at the moment, and I'm having a bit of trouble with the behavior of a modal RadWindow.
With normal modal WPF windows, if you click on the owner window, you get an alert noise and the child modal window flashes to draw your attention.  With RadWindow I only get the alert noise.

I couldn't find this behavior built in to RadWindow, so I was wondering if there's some event on either the owner or child windows I could listen to and manually trigger an animation?

Thanks.
Konstantina
Telerik team
 answered on 25 Jul 2011
8 answers
606 views

I’m currently in the process of evaluating the RadGrid.

If I add aggregates to the radgrid can I get the aggregate output to display at the bottom of the row as opposed to along side the grouping label. At the very least can I get the information to go above the row that’s being aggregated.

For example in the samples you have a table with a column called quantity, I want to sum the quantity column by adding an aggregate (which is simple to do) and I want to display the sum value below all the quantity values for the grouping, how ever its currently being displayed beside the label.

Thanks  

gao
Top achievements
Rank 1
 answered on 25 Jul 2011
3 answers
111 views
I would like to sort my GridView so that the selected items appear at the top.

It appears that there is no ColumnSortDescriptor type for WPF (however after reading documentation it appears that this type exists for the Silverlight GridView control)....maybe I'm just not looking in the right namespace (it's not in the Telerik.Windows.Data namespace)

Anyways, I would love it if some could explain how I could accomplish this.


Thank you.
Dimitrina
Telerik team
 answered on 25 Jul 2011
1 answer
112 views
Hello!
In my application I am trying to sort columns of grouped dynamic objects (e.g. implementing IDynamicMetaObjectProvider). It works fine until I try to sort a column of a grouped list, throwing a null exception in private static IEnumerable<PropertyDescriptor> GetPropertyDescriptorsForDynamicType(QueryableCollectionView collectionView) in ItemPropertyInfoHelper.cs:

Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.GetPropertyDescriptorsForDynamicType(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 184 + 0x30 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.GetPropertyDescriptors(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 86 + 0x1a bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.ItemPropertyInfoHelper.CreateItemProperties(Telerik.Windows.Data.QueryableCollectionView collectionView) Line 41 + 0xa bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.GetItemProperties() Line 38 + 0xa bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.QueryableCollectionView.ItemProperties.get() Line 29 + 0x14 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.ItemPropertiesAreDifferent(Telerik.Windows.Data.QueryableCollectionView newCollectionView, Telerik.Windows.Data.QueryableCollectionView oldCollectionView) Line 216 + 0x35 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.CollectionView.set(Telerik.Windows.Data.QueryableCollectionView value) Line 103 + 0x16 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.CreateAndSetCollectionView(System.Collections.IEnumerable source) Line 932 + 0x3a bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Data.DataItemCollection.SetItemsSource(System.Collections.IEnumerable source) Line 713    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind.AnonymousMethod__17() Line 3646    C#
Telerik.Windows.Controls.dll!Telerik.Windows.Controls.CursorManager.PerformTimeConsumingOperation(System.Windows.FrameworkElement frameworkElement, System.Action action) Line 16 + 0xf bytes    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.Bind(object newValue) Line 3675    C#
Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.OnItemsSourceChanged(object oldValue, object newValue) Line 3267 + 0x15 bytes    C#
Telerik.Windows.Data.dll!Telerik.Windows.Controls.DataControl.OnItemsSourcePropertyChanged(System.Windows.DependencyObject origin, System.Windows.DependencyPropertyChangedEventArgs args) Line 144    C#

The problem is that GetPropertyDescriptorsForDynamicType accesses the first element in the collectionview and tries to cast it to an IDynamicMetaObjectProvider:

var dynamicObject = collectionView.ElementAt(0) as System.Dynamic.IDynamicMetaObjectProvider;
var metaObject = dynamicObject.GetMetaObject(System.Linq.Expressions.Expression.Constant(dynamicObject));

When grouping the first element is of type AggregateFunctionsGroup and not of Type ElementType (which made the code branch into this function in the first place). To get the correct dynamic object, the line would have to be changed to get the first element of the first group that has elements but no children (or something similiar)..

I could use an ITypedList in order to not branch into GetPropertyDescriptorsForDynamicType, but it should work this way as well.
I have tried the latest internal build, but the problem remains.
Can you reproduce this problem?
Kind Regards,
Karin Huber

Dimitrina
Telerik team
 answered on 25 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?