This is a migrated thread and some comments may be shown as answers.

Expand button disappears in RadTreeListView

8 Answers 133 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Dalibor
Top achievements
Rank 1
Dalibor asked on 03 Oct 2012, 03:03 PM
Hi Telerik,
After running code bellow expand button disappears. Click e.g. on Carrot in my sample.
The bug can be found at at least 2 latest releases including the newest SP release.
I tried to simplify it to smallest possible code.
This code causes to disappear expand arrow:
public partial class MainPage : UserControl
  {
     public MainPage()
     {
        InitializeComponent();
        radTreeListView.ItemsSource = WarehouseService.GetWarehouseData();
        radTreeListView.RowLoaded += radTreeListView_RowLoaded;
     }
  
     void radTreeListView_RowLoaded(object sender, Telerik.Windows.Controls.GridView.RowLoadedEventArgs e)
     {
        TreeListViewRow treeRow = e.Row as TreeListViewRow;
        if (treeRow != null)
        {
           treeRow.IsExpandable = true; // this line causes to disappear expandable arrow
        }          
     }
  }
...
public class WarehouseService
{
   public static ObservableCollection<WarehouseItem> GetWarehouseData()
   {
      ObservableCollection<WarehouseItem> data = new ObservableCollection<WarehouseItem>();
      WarehouseItem drinks = new WarehouseItem("Drinks", 35);
      WarehouseItem water = new WarehouseItem("Water", 10);
      water.Items.Add(new WarehouseItem("Fresh", 10));
      water.Items.Add(new WarehouseItem("Salty", 10));
      drinks.Items.Add(water);
      WarehouseItem tea = new WarehouseItem("Tea", 20);
      tea.Items.Add(new WarehouseItem("Black", 10));
      tea.Items.Add(new WarehouseItem("Green", 10));
      drinks.Items.Add(tea);
      drinks.Items.Add(new WarehouseItem("Coffee", 5));
      data.Add(drinks);
      WarehouseItem vegetables = new WarehouseItem("Vegeatbles", 75);
      vegetables.Items.Add(new WarehouseItem("Tomato", 40));
      vegetables.Items.Add(new WarehouseItem("Carrot", 25));
      vegetables.Items.Add(new WarehouseItem("Onion", 10));
      data.Add(vegetables);
      WarehouseItem fruits = new WarehouseItem("Fruits", 55);
      fruits.Items.Add(new WarehouseItem("Cherry", 30));
      fruits.Items.Add(new WarehouseItem("Apple", 20));
      fruits.Items.Add(new WarehouseItem("Melon", 5));
      data.Add(fruits);
      return data;
   }
}

8 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 04 Oct 2012, 05:52 AM
Hi,

 Can you post more info about your treelist version? 

All the best,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dalibor
Top achievements
Rank 1
answered on 04 Oct 2012, 06:16 AM
Hi,
The version is 2012.2.912.1050. I tried also a version before with the same result.
Workaround is also welcome.
Dalibor
0
Vera
Telerik team
answered on 08 Oct 2012, 02:59 PM
Hi Dalibor,


May i ask you to share more details about your scenario? What would be the expected behavior?

Looking forward to hearing from you.

 

All the best,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dalibor
Top achievements
Rank 1
answered on 09 Oct 2012, 08:58 AM
Hi Telerik,
My expectation is that all expandable buttons are visible after click. See this video https://rapidshare.com/files/950332071/2012-10-09_1048.zip
You can see that buttons appear again if I play with it a bit.
Dalibor
0
Shawn
Top achievements
Rank 1
answered on 17 Oct 2012, 10:00 PM
I have the exact same problem.  I've traced the problem back to the Q2 2011 performance enhancements made in the RadGridView and RadTreeListView controls.  If I use the Q1 2011 SP1 libraries, then the code below works great - expanding a treelistviewitem shows it's children and all other parent items keep their expand buttons.  If I use the Q2 2011 SP1 libraries (or any other later version including the latest Q2 2012 SP2), then when I click on an expand icon then most other expand icons disappear.  Closing the expanded item shows the other expand icons again.

In debugging through the code, the radTreeListViewRowLoaded method is only being called on some of the visible rows in the RadTreeListView, not all of them.  In the Q1 2011 SP1 libraries, the radTreeListViewRowLoaded is called on all visible rows.

The rows that have radTreeListViewRowLoaded called show up correctly.  All rows are apparently reset to default every time any row is expanded and those who don't have radTreeListViewRowLoaded called have their expand button disappear.  If I scroll the TreeListView so these rows are hidden and then visible again, then the rows correctly show the expand button.

I've attached screen shots of before clicking an expand button and after.

0
Dalibor
Top achievements
Rank 1
answered on 07 Dec 2012, 12:03 PM
Any update?
0
Dalibor
Top achievements
Rank 1
answered on 29 May 2013, 05:10 AM
Hi Telerik,
would you please update us if you have already solved the problem?
Dalibor
0
Shawn
Top achievements
Rank 1
answered on 29 May 2013, 02:28 PM
I put in a support ticket, and here is the response I got:
----------------------
Hi Shawn,

 I've changed a bit your code to illustrate you how to fix this. Please use styles/styles selectors instead RowLoaded. Our optimization affected this since now rows are not removed but reused and RowLoaded will not be raised while styles will be reevaluated. 

I've attached modified version of your project for reference. 

Greetings,
Vlad
the Telerik team
--------------------------

Here is my original xaml code:
<telerik:RadTreeListView x:Name="dgSummary" ItemsSource="{Binding SummaryInstalled}"
RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" IsReadOnly="True"
SelectionMode="Extended" BorderBrush="{x:Null}" CanUserFreezeColumns="False"
GridLinesVisibility="None" ShowGroupPanel="False" RowLoaded="DgSummaryRowLoaded"
RowIsExpandedChanging="DgSummaryRowIsExpandedChanging" Margin="0">

This is what Vlad suggested in the xaml, and it works for me:
<telerik:RadTreeListView x:Name="dgSummary" ItemsSource="{Binding SummaryInstalled}"
RowIndicatorVisibility="Collapsed" AutoGenerateColumns="False" IsReadOnly="True"
SelectionMode="Extended" BorderBrush="{x:Null}" CanUserFreezeColumns="False"
GridLinesVisibility="None" ShowGroupPanel="False"
RowIsExpandedChanging="DgSummaryRowIsExpandedChanging" Margin="0">
             
<telerik:RadTreeListView.RowStyle>
    <Style TargetType="telerik:TreeListViewRow">
         <Setter Property="IsExpandable" Value="{Binding IsExpandable}" />
    </Style>
</telerik:RadTreeListView.RowStyle>

This was my original code behind file:
private void DgSummaryRowLoaded(object sender, RowLoadedEventArgs e)
{
    var row = e.Row as TreeListViewRow;
    if (row != null)
    {
        row.IsExpandable = ((ProductSummary) row.DataContext).LdmsProductType == LdmsProduct.ProductGroup;
    }
}

Vlad suggested removing the DgSummaryRowLoaded method and instead extending my ProductSummary object using the following code:
public partial class ProductSummary
{
    public bool IsExpandable
    {
        get { return LdmsProductType == LdmsProduct.ProductGroup; }
    }
}

Hope this helps you if you are experiencing the same problems!
Shawn
Tags
TreeListView
Asked by
Dalibor
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Dalibor
Top achievements
Rank 1
Vera
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or