locked
WPF TreeView HierarchicalDataTemplate RRS feed

  • Question

  • How to show parent name? when i move the mouse upon a child item of it.

    ToolTip=?????

    <HierarchicalDataTemplate x:Name="xxxxx" DataType="{x:Type local:DataAttribute}" ItemsSource="{Binding items}">
        <TextBlock Text="{Binding Name}"
                    ToolTip=How to Binding it's parent name???/>
    </HierarchicalDataTemplate>
    public class DataAttribute {
        public DataAttribute()
        {
            this.items = new List<DataAttribute>();
            this.ParentID = -1;
        }
        public int ID { get; set; }
        public string Name { get; set; }
        public int ParentID { get; set; }
        public List<DataAttribute> items { get; set; }
    }

    e.g:

    When i move mouse upon "BeiJing", ToolTip will show "China".




    • Edited by oneonce Monday, December 21, 2015 12:55 AM
    Sunday, December 20, 2015 3:57 PM

Answers

  • You've posted this on the wrong forum, this is the WFP (windows filtering platform) forum rather than WPF.
    • Marked as answer by oneonce Monday, December 21, 2015 4:44 PM
    Monday, December 21, 2015 12:55 PM