Telerik Forums
UI for WPF Forum
2 answers
324 views

Our use case is to have a grid which can be expanded to show more granular details including child data, similar to your samples.  One of the catches is that not all the data is available in the ItemsSource collection of objects.  To avoid what will appear as a memory leak over time, we chose to load / unload the child data as needed.  We have success using the RowIsExpandedChanged event to manage the data.  We also use the HierarchyChildTemplate and specify the DataTemplate as a collective group of controls and UserControls.  

One of these UserControls is another GridView to present a collection of child details of the parent record.  This user control will subscribe to events and update its grid with additions and edits.  To wire up these events we use an identifier passed to the control via a DependancyProperty.  We have found that once a row has been expanded and the UserControl initialized for those events it will remain in effect even when the row is collapsed.  To confirm this we wired up the CoerceValueCallback on the DependancyProperty and it is not getting fired when we expand the row after the first time.  We understand that due to the virtualization rows are destroyed when out of view. So, in turn, just the event of the user scrolling around will perform a sort of "clean up."  As good practice of not leaving resources in use when no longer visible, is there some property we should be setting to destroy the HierarchyChildTemplate when the row is collapsed? 

Here are some segments of code we are using. 

<Telerik:RadGridView Grid.Row="1" x:Name="radGridViewMain" ItemsSource="{Binding Incidents}"

 IsReadOnly="True" AutoGenerateColumns="False" CanUserFreezeColumns="False"

RowIsExpandedChanged="radGridViewMain_RowIsExpandedChanged"

 ShowGroupPanel="True" RowIndicatorVisibility="Collapsed"

TelerikGridViewHeaderMenu:GridViewHeaderMenu.IsEnabled="True"

 CustomFilter:CustomFilterBehavior.TextBox="{Binding ElementName=textBoxFilter}">

 

 

 

<Telerik:RadGridView.ChildTableDefinitions>

<Telerik:GridViewTableDefinition>

<Telerik:GridViewTableDefinition.Relation>

<TelerikWindowsData:PropertyRelation ParentPropertyName="PrimaryKey"/>

</Telerik:GridViewTableDefinition.Relation>

</Telerik:GridViewTableDefinition>

</Telerik:RadGridView.ChildTableDefinitions>

<Telerik:RadGridView.HierarchyChildTemplate>

<DataTemplate>

<Controls:ChildItems PrimaryKey="{Binding PrimaryKey}"  />

 

 

 

Paul
Top achievements
Rank 1
 answered on 27 Feb 2012
1 answer
114 views
Hi,
I have a radtileview with a small number of tiles and I am attempting to loop through the tiles and maximse each one in turn form code behind. I get the  'Object reference not set to an instance of an object.' error when maximise is called. Can you put me right with this.
Regards,
Joe

The Code:

 

For I As Integer = 0 To Me.RadTileView1.Items.Count - 1

Dim item As RadTileViewItem = TryCast(Me.RadTileView1.Items(6), RadTileViewItem)

item.TileState =

 

TileViewItemState.Maximized

Thread.Sleep(5000)

Next


Zarko
Telerik team
 answered on 27 Feb 2012
1 answer
67 views
Hi,

Anybody can help me,
I need to provide the ability to store number of fixed (by user) filters and also the ability to activate each one by single-click. (like Favorites).

Thanks a lot
Dimitrina
Telerik team
 answered on 27 Feb 2012
7 answers
435 views
Currently, groups are sorted alphabetically by their first constituent property definition (eg, if group 1 contains B, C, and D while group 2 contains A, E, and F, group 2 will appear first). Is there a way to control the sorting behavior of the groups-- for example, to sort by the groupname rather than by it's constituents? If not, is such a feature planned?
Ivan Ivanov
Telerik team
 answered on 27 Feb 2012
1 answer
126 views
I need to set those 3 buttons ( navigate left , navigate right and the middle one who opens up a datetimepicker) Enabled = False in some scenarios. I did succed for the left and right navigation buttons by searching through their parents untill i reach the RadScheduleView type (using GetVisualParent<RadScheduleView>()). I dont know why this is not happening for the middle button too. Please help.
Thank you !

Edit : Please let me know if there is a short way to do that instead of my approach.
Dorin
Top achievements
Rank 1
 answered on 27 Feb 2012
1 answer
77 views
I'm trying to create a list of charts, widgets, that are being bound based off of data coming back from the database. Given that the DataPoints, ChartType, and also the number of DataSeries are dynamic in every way, I've come up with a solution to use a DataTemplate that has a RadChart object and on that chart I set the SeriesMappings property by running the object through a Converter. The converter then returns back a SeriesMappingCollection, which I thought should be good, but instead the graph plots two points, 8 & 5 which happen to be the Capacity and Count (respectively) of the bound object. We've tried to get this to work for most of the day with no luck. One last thing, we did test to ensure the mappings work in straight XAML and it does, so we were able to rule that out as well. If anyone has any thoughts on this, that would be much appreciated.

RadChart within the DataTemplate:
<telerik:RadChart Grid.Row="1" SeriesMappings="{Binding Path=., Converter={StaticResource WidgetObjToSeriesMappingConverter}}" ItemsSource="{Binding Path=DataSeriesRoot}"/>

public class WidgetObjToSeriesMappingConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return null;
 
            var seriesMappingCol = new SeriesMappingCollection();
            var barChartWidget = (BarChartWidget)value;
 
            //Loop through each series, and configure
            for (int i = 0; i < barChartWidget.DataSeriesRoot.Count; i++)
            {
                var seriesMapping = new SeriesMapping();
 
                //Check what type of chart it will be
                if (value.GetType() == typeof(BarChartWidget))
                    seriesMapping.SeriesDefinition = new BarSeriesDefinition();
 
                seriesMapping.CollectionIndex = i;
                seriesMapping.SeriesDefinition.ShowItemLabels = false;
                seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XCategory));
                seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
                //Add the series to the collection
                seriesMappingCol.Add(seriesMapping);
            }
            //Return SeriesMapping collection object
            return seriesMappingCol;
        }
 
        object IValueConverter.ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
Ves
Telerik team
 answered on 27 Feb 2012
4 answers
959 views
I have created an attached behavior that allows you to select multiple rows in a grid, edit a cell and upon the edit completing, the changed value is applied to the cells in the same column of the selected rows. This works just fine.

However, setting the grid with SelectionMode="Extended" allows multiple rows to be selected but doesn't allow you to use the mouse to click on the selected row and drag to select more rows. I asked about this and Milan advised to use DragElementAction="ExtendedSelect" which is exactly what I wanted but setting it interferes with the selected rows.

Once multiple rows are selected, clicking on the outlined cell on the current row puts the cell into edit mode (as expected) but all the other selected rows disappear. If I remove the DragElementAction property the selected rows do not change when going into edit mode.

The attached behavior I did does not change the selected rows. I would like to be able to retain the multi-edit behavior and the extended selection drag action. SelectionUnit needs to be FullRow. Any help would be appreciated. Thanks.
dpl
Top achievements
Rank 1
 answered on 27 Feb 2012
0 answers
91 views
I have a applied a template on a GridView row. This template contains a TextBox. When I edit text in the TextBox, the CellValidating event is not fired as would be the case with a non-templated GridView row. Is there a way to wire up CellValidating to a templated row?

In the following example, I would like the RadGridViewCellValidating handler to be called when text in the TextBox in the DocumentRowTemplate is changed. Is this possible?

<Window
    x:Class="GridViewTest.MainWindow"
    Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <ControlTemplate x:Key="DocumentRowTemplate">
            <TextBox Text="{Binding MyText}"/>
        </ControlTemplate>
 
        <Style x:Key="DocumentRowStyle" TargetType="{x:Type telerik:GridViewRow}">
            <Setter Property="Template" Value="{DynamicResource DocumentRowTemplate}"/>
        </Style>
    </Window.Resources>
 
    <telerik:RadGridView
        ItemsSource="{Binding MyEntities}"
        AutoGenerateColumns="False"
        RowStyle="{DynamicResource DocumentRowStyle}"
        CellValidating="RadGridViewCellValidating"/>
     
</Window>
Erik
Top achievements
Rank 1
 asked on 26 Feb 2012
0 answers
104 views
hi..i build a setup of a project to be deployed which build using sqlserver+tererik(old version) wpf controls in windows xp desktop..it worked fine.
and now i want same to be done in  my win7 ultmiate laptop using new telerik which is present available on air. .. im unable to deploy it..plz can u tell me??
srinivasskc
Top achievements
Rank 1
 asked on 25 Feb 2012
1 answer
480 views
I believe this is quite a common issue.

When I include the Aggregate function for a column in the RadGridView, there is a lot of space between the last row and the footer.  I am not setting any height to the grid.

<telerik:RadGridView AutoExpandGroups="True"
                                  AutoGenerateColumns="False"
                             CanUserFreezeColumns="False"
                             ShowGroupPanel="False"
                             Grid.Row="1"
                             ItemsSource="{Binding Path=Items}"
                               IsBusy="{Binding Path=IsLoading}"
                             ShowColumnFooters="True">

Any clue to how this can be fixed?  I have attached a screen shot of the Grid. 
Gautam
Top achievements
Rank 1
 answered on 24 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?