I was using the radtreeview with quite a lot of nodes and found that performance was slow. I read telerik documentation and it said I can use treelistview as an alternative to treeview. Now when I try to implement loadondemand on this treelist view, during the isexpand property even though the children are added to collection the grid is not refreshed. Since this collection is stored as static variable, when I close the form and open it it displays the parent and children. My isexpanded is implemented in viewmodel where it hits the db and gets the collection. Is there something I am missing in order to implement loadondemand or is this feature not available. I am using WPF Q2 SP1 controls
<
<Window.Resources>
<Style x:Key="TreeListViewStyle" TargetType="{x:Type telerik2:TreeListViewRow }">
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
</Style>
</Window.Resources>
<telerik:RadTreeListView x:Name="rdTreeList" AutoGenerateColumns="False"
Width="Auto" RowStyle="{StaticResource TreeListViewStyle}"
ItemsSource="{Binding UnitValueObjectList,Mode=TwoWay}"
>
<telerik:RadTreeListView.ChildTableDefinitions>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Path=ChildNodes,Mode=TwoWay}" >
</telerik:TreeListViewTableDefinition>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Path=ChildNodes,Mode=TwoWay}"/>
<telerik:TreeListViewTableDefinition ItemsSource="{Binding Path=ChildNodes,Mode=TwoWay}"/>
</telerik:RadTreeListView.ChildTableDefinitions>
<telerik:RadTreeListView.Columns>
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name,Mode=TwoWay}" Header="Name" />
</telerik:RadTreeListView.Columns>
</telerik:RadTreeListView>
>
<
Style
TargetType
=
"{x:Type telerik:GridViewGroupPanel}"
>
<
Setter
Property
=
"BorderThickness"
Value
=
"5"
/>
</
Style
>
Hi,
I am using custom context menu to apply flter on hierarchical radtreelistview.
I am binding the radtreelistview to an ObservableCollection<>.
In order to apply filter, I am using the below code
private
void RadMenuItem_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
{
if ((sender as RadMenuItem).Header.Equals("Filter By Selection"))
{
FilterDescriptor descriptor = new FilterDescriptor();
descriptor.Member = strClickedColumn;
descriptor.Operator = FilterOperator.IsEqualTo;
descriptor.Value = strClickedColumnData;
this.RadTreeListView1.FilterDescriptors.Add(descriptor);
}
}
But i am not getting the desired results.
Instead,the radtreelistview displays 0 items.
Can you please share a sample project which provides a working solution for custom filter?
<
Style
TargetType
=
"{x:Type telerik:RadTreeViewItem}"
>
<
Setter
Property
=
"IsExpanded"
Value
=
"True"
/>
</
Style
>
I have I problem with a RadGridView. ..
I'm using the MVVM pattern and each row in the gridview is bound to its own ViewModel. At a certain point in the execution of the program I save a row to the database (this is done in the ViewModel of the row). This might have the consequence that some property in the ViewModel of the row is updated. Therefore I trigger the PropertyChanged event without specifying a property name, which will tell the row in the GUI to read the values of all the properties it is bound to.
My problem is that sometimes when I do this, the gridview tries to set the old values of the properties back to the ViewModel. Let's say I have a column bound to a property "Age" that has the value 34; then it will set the value of the property to 34. Normally, this is not a problem (since in the end the property will still have the same value). However, my rows can have one of two states, and in one of those states some of the cells/properties are not allowed to change. I enforce this in the GUI so that it is impossible to change a value of a cell/property that is not allowed to change. But to really make sure this never happens (in case some developer makes a mistake in the GUI), I throw an exception in the ViewModel if you try:
public
int
Age
{
get
{
return
_age; }
set
{
if
(IsAllowedToChangeAge)
{
if
(value != _age)
{
_age = value;
OnPropertyChanged(
"Age"
);
}
}
else
{
//The GUI should make sure this never happens.
throw
new
Exception(
"Cannot change age if..."
);
}
}
}
This works fine in normal cases because the GUI makes sure it never happens. In the example above, the user won't be able to edit the cell bound to Age if the IsAllowedToChangeAge property is false.
BUT as mentioned, sometimes when the ViewModel tells the gridview to update (through the PropertyChanged event), the gridview itself tries to set the values of the grid (to the same values as it had). When this happens and and the row is in a state that doesn't permit the values to change, the exception will be thrown!
How can I get around this? Why does the gridview set the same values as it already has? Can I stop this from happening? I have not found a pattern for when it happens...
I could get around this by not throwing an exception, but I'd really like to keep it to catch any developer mistakes.
Thanks // David
How can i reorder columns in TreeListView?
In GridView works fine but in TreeListView not :(