Filtering on a column and including the heirarchy

3 posts, 0 answers
  1. Steve
    Steve avatar
    1 posts
    Member since:
    Jul 2010

    Posted 09 Aug 2011 Link to this post

    We have a hierarchical set of classes that all inherit the interface IGenericLineItem.  The interface looks something like:

    public interface IGenericLineItem
    {
        ...
        string Name { get; }
        IGenericLineItem Parent { get; }
        ObservableCollection<IGenericLineItem> SubItems { get; }
        ...
    }

    and several classes like

    public class TopLevelLineItem : IGenericLineItem
    {
        public TopLevelLineItem()
        {
            this.SubItems = // generate collection of SecondLevelLineItems, having each Parent is set to `this`
        }
    }
     
    public class SecondLevelLineItem : IGenericLineItem
    {
        public SecondLevelLineItem()
        {
            this.SubItems = // generate collection of BottomLevelLineItems, having each Parent is set to `this`
     
        }
    }
     
    public class BottomLevelLineItem : IGenericLineItem
    {
        public BottomLevelLineItem()
        {
            this.SubItems = // generate collection of further BottomLevelLineItems, having each Parent is set to `this`
        }
    }


    So we have in our ViewModel an IEnumerable<IGenericLineItem> that gets bound to a RadTreeListView, with the ChildTableDefinition set up like this:
    <telerik:RadTreeListView.ChildTableDefinitions>
        <telerik:TreeListViewTableDefinition ItemsSource="{Binding SubItems}">
        </telerik:TreeListViewTableDefinition>
    </telerik:RadTreeListView.ChildTableDefinitions>

    We want to be able to filter on the Name column for the top level line items, but we want it to still show the subitems of all the matched top level items.  The default filter is great in that it's only showing the list of top level items, but when it actually filters it doesn't show the hierarchy.  Is there some way to override the filter take what the user entered and amend it with something like 
    «CurrentItem».Name «Operator» «Value» || «CurrentItem».GetParentOfType<TopLevelLineItem>().Name «Operator» «Value»

  2. Jessica
    Jessica avatar
    12 posts
    Member since:
    Jun 2011

    Posted 27 Sep 2011 Link to this post

    I am also looking for this solution. Is it possible in WPF?
  3. DevCraft banner
  4. AKROS
    AKROS avatar
    68 posts
    Member since:
    Oct 2011

    Posted 07 Dec 2011 Link to this post

    Same question here. It looks like that it's not possible yet :(
Back to Top