Hello,
how can I show a NodeLayout based on the implemented class?
I have a List<IExpression>. When the List is filled, I am using the concrete implmention.
<ig:XamDataTree ItemsSource="{Binding TreeNodes}" NodeLayoutAssigned="XamDataTree_NodeLayoutAssigned"> <ig:XamDataTree.GlobalNodeLayouts> <ig:NodeLayout Key="ExpressionOperatorNode" TargetTypeName="ExpressionOperatorNode"> <ig:NodeLayout.ItemTemplate> <DataTemplate> <Label Content="{Binding Data.Label}"/> </DataTemplate> </ig:NodeLayout.ItemTemplate> </ig:NodeLayout> <ig:NodeLayout Key="ExpressionGroupNode" TargetTypeName="ExpressionGroupNode"> <ig:NodeLayout.ItemTemplate> <DataTemplate> <Label Content="{Binding Data.GroupLable}"/> </DataTemplate> </ig:NodeLayout.ItemTemplate> </ig:NodeLayout> </ig:XamDataTree.GlobalNodeLayouts> </ig:XamDataTree>
class ExpressionTreeViewModel { public ExpressionTreeViewModel() { TreeNodes = new List<IExpressionNode>(); TreeNodes.Add( new ExpressionOperatorNode(ExpressionOperator.Or, new List<IExpressionNode> { new ExpressionGroupNode("Region Group", new List<IExpressionNode>() { new ExpressionOperatorNode(ExpressionOperator.And, new List<IExpressionNode>() { new ExpressionConditionNode(), new ExpressionConditionNode() }) }) })); } #region +++ Published Properties +++ public List<IExpressionNode> TreeNodes { get; } #endregion +++ Published Properties +++ }
I believe you are on the right track with using GobalNodeLayouts. I attached a sample that I believe is tailored to your requirement using templates. You don't be able to manually create the layouts from my understanding with this setup. Let me know if you have any questions.
Microsofts Tree interfaces.zip
Thanks for the sample. I don't want to create the layout in code, by the converter. I would like to design it in xaml, and use it for the derived type. Similar to the TreeView listed in that sample.
How can I do that?