Hi,
Welcome to Microsoft Q&A!
In the code-behind, you could add this using statement at the top of the code:
using muxc = Microsoft.UI.Xaml.Controls;
In addition, the ItemInvoked event args give you access to the invoked item. The InvokedItem property has the node that was invoked. You can cast it to a TreeViewNode and get the data item from the TreeViewNode.Content property. As follows:
private void myTreeView_ItemInvoked(muxc.TreeView sender, muxc.TreeViewItemInvokedEventArgs args)
{
var node = args.InvokedItem as muxc.TreeViewNode;
myTextBlock.Text= node.Content.ToString();
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.