I have a TreeView, and I get the selected data this way:
string year = "";
foreach (var a in tbYear.SelectedNodes)
{
year = year + a.ToString();
}
How can I do the opposite, that is, receive the years and put in TreeView the years I get selected.
Something, like this:
public myclass myinfodata;
<muxc:TreeView x:Name="tbYear" SelectedNode="{x:Bind myinfodata.year}" SelectionMode="Multiple">
<muxc:TreeView.RootNodes>
<muxc:TreeViewNode Content="Year" IsExpanded="False">
<muxc:TreeViewNode.Children>
<muxc:TreeViewNode Content="1º"/>
<muxc:TreeViewNode Content="2º"/>
<muxc:TreeViewNode Content="3º"/>
<muxc:TreeViewNode Content="4º"/>
<muxc:TreeViewNode Content="5º"/>
<muxc:TreeViewNode Content="6º"/>
<muxc:TreeViewNode Content="7º"/>
<muxc:TreeViewNode Content="8º"/>
<muxc:TreeViewNode Content="9º"/>
<muxc:TreeViewNode Content="10º"/>
<muxc:TreeViewNode Content="11º"/>
<muxc:TreeViewNode Content="12º"/>
</muxc:TreeViewNode.Children>
</muxc:TreeViewNode>
</muxc:TreeView.RootNodes>
</muxc:TreeView>
I tried this way, but it doesn't work