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
130
How to retrieve XamTreeItem Name.
posted

Hello,

I was wondering how do I go about retrieving the name of XamTreeItem that you click on.

For example if this was my tree in xaml.

<ig:XamTreeItem Name="Person" Header="Person">
                <ig:XamTreeItem Name="cboCreator" Header="Creator" />
                <ig:XamTreeItem Name="cboReference" Header="Reference"/>
                <ig:XamTreeItem Name="cboContributor" Header="Contributor"/>
                <ig:XamTreeItem Name="dgDonor" Header="Donor"/>

</ig:XamTreeItem>

Say the user clicks on XamTreeItem "cboCreator".  In my C# code, how I do retrieve the selected item name?

Thanks for the reply,

Kiet

 

 

 

 

Parents
  • 5520
    Suggested Answer
    posted

    put them in a XamTree

    <ig:XamTree Height="100" HorizontalAlignment="Left" Margin="142,146,0,0" Name="xamTree1" VerticalAlignment="Top" Width="200" SelectionChanged="xamTree1_SelectionChanged">

                <ig:XamTreeItem Name="Person" Header="Person">

                    <ig:XamTreeItem Name="cboCreator" Header="Creator" />

                    <ig:XamTreeItem Name="cboReference" Header="Reference"/>

                    <ig:XamTreeItem Name="cboContributor" Header="Contributor"/>

                    <ig:XamTreeItem Name="dgDonor" Header="Donor"/>

     

                </ig:XamTreeItem>

    </ig:XamTree>

     

    and use the event:

    private void xamTree1_SelectionChanged(object sender, SelectionChangedEventArgs e)

            {

                string s;

                if (e.AddedItems.Count > 0)

                s = ((Infragistics.Controls.Menus.XamTreeItem)e.AddedItems[0]).Name;

            }

Reply Children
No Data