I'm trying to assign a value to My TreeView with the name "tbYear", this value I want to assign comes from My API. I'm getting the value correctly, I just have to be able to realize this piece of code. I'm using UWP, C#.
My TreeView in file.xaml
<muxc:TreeView x:Name="tbYear">
<muxc:TreeView.RootNodes>
<muxc:TreeViewNode Content="Year" IsExpanded="False">
<muxc:TreeViewNode.Children>
<muxc:TreeViewNode Content="1º"/>
<muxc:TreeViewNode Content="2º"/>
</muxc:TreeViewNode.Children>
</muxc:TreeViewNode>
</muxc:TreeView.RootNodes>
</muxc:TreeView>
My file.xaml.cs
private async void GetData
{
srcResults = await apiclient.GetValues();
tbYear.SelectedItem = srcResults.Year;
}
But i get the error: "Cannot implicityl convert type 'string' to 'Microsoft.UI.Xaml.Controls.TreeViewNode'"
How can I solve it?