Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3220
xamDataTree different Layouts for different class implementation
posted

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 +++
    }

Parents
  • 29105
    Offline posted

    Hello,

    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

Reply Children