Global Grid Style Breaks RowExpand/Collapse

2 posts, 0 answers
  1. Andy
    Andy avatar
    3 posts
    Member since:
    Aug 2010

    Posted 31 Oct 2010 Link to this post

    Having this style defined in app.xaml...

    <Style TargetType="Grid">
        <Setter Property="Background" Value="#00000000" />

    .. breaks the TreeListView expand/collapse behaviour.  This breaks regardless of the value of the Background.  This was an extremely time consuming and frustrating bug to track down.

    Full sample:

    <Window x:Class="TreeListViewExample.MainWindow"
            xmlns:x="" xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" Title="MainWindow" Height="350" Width="525">
            <Controls:RadTreeListView ItemsSource="{Binding Items}" AutoGenerateColumns="False">
                    <Controls:TreeListViewTableDefinition ItemsSource="{Binding Children}"/>
                    <Controls:GridViewDataColumn Header="Test" DataMemberBinding="{Binding Text}"/>

    <Application x:Class="TreeListViewExample.App"
            <Style TargetType="Grid">
                <Setter Property="Background" Value="Green"/>

    public partial class MainWindow : Window
       public MainWindow()
          DataContext = this;
          Items = new ObservableCollection<TestClass>();
          var child3 = new TestClass {Text = "child 3"};
          var child2 = new TestClass {Text = "child 2", Children = new[] {child3}};
          var child = new TestClass {Text = "child", Children = new[] {child2}};
       public ObservableCollection<TestClass> Items { get; private set; }
    public class TestClass
       public string Text { get; set; }
       public IEnumerable<TestClass> Children { get; set; }


  2. Vanya Pavlova
    Vanya Pavlova avatar
    2019 posts

    Posted 04 Nov 2010 Link to this post

    Hi Andy,

    Generally it is not a good practice to create an implicit style for the Grid that acts as a layout container in your application. If you take a look at the template of RadTreeListView you will see that a number of Grids are used and when you create such global style, it is applied to all of them, and thinking in this way this is not recommended approach. If you want to maintain this style just make it explicit instead of implicit and set it as a DynamicResource to your LayoutRoot.

    Vanya Pavlova
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top