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

Clear cells if row has expanded data

1 Answer 58 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 30 Nov 2010, 05:03 PM
I have a tree view with financial information.  For a row that is not expanded, the cells show the totals of the hidden rows below.  When expanding a row (showing the details), I want to clear the cells of the parent row so I just show the detail.

Below is the relevant code, it is firing for the secondary rows, but not for the expanded row.  

Thanks,

Pat

    private void radTreeListView1_RowLoaded(object sender, RowLoadedEventArgs e)
    {
      var row = e.Row as TreeListViewRow;
      if (row != null)
      {
        var binding = new Binding("IsRowExpanded") { Source = row.Item };
        binding.Mode = BindingMode.TwoWay;
        row.SetBinding(TreeListViewRow.IsExpandedProperty, binding);
      }
    }
  }
  public class HeaderRowSelector : DataTemplateSelector
  {
    public DataTemplate BlankCell    { getset; }

    public DataTemplate NormalCell    { getset; }

    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
      FFSLStoreReportDataItem itm = item as FFSLStoreReportDataItem;

      if(itm.IsRowExpanded)
        return BlankCell;
      else
         return NormalCell;

    }
  }
}

namespace FFSLClient.FFSLServer
{
  public partial class FFSLStoreReportDataItem
  {
    private bool _IsRowExpanded;
    public bool IsRowExpanded
    {
      get
      {
        System.Diagnostics.Debug.WriteLine("Getting IsRowExpanded, Value:" + _IsRowExpanded.ToString());
        return _IsRowExpanded;
      }
      set
      {
        System.Diagnostics.Debug.WriteLine("SETTING IsRowExpanded, Value:" + value.ToString());
        _IsRowExpanded = value;
      }
    }
  }

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 06 Dec 2010, 02:24 PM
Hello Patrick,

Yes, RowLoaded event is not appropriate in this case.

Please try with the RowIsExpandedChanging or RowIsExpandedChanged events and let us know if it helps.


Greetings,
Veselin Vasilev
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
Tags
TreeListView
Asked by
Patrick
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Share this question
or