When I create a new listPage, the xaml code is the following:
<Grid Style="{StaticResource ContentRoot}">
<!-- TODO: set @SelectedSource -->
<mui:ModernTab Layout="List">
<mui:ModernTab.Links>
<!-- TODO: set @Source -->
<mui:Link DisplayName="Item 1" />
<mui:Link DisplayName="Item 2" />
</mui:ModernTab.Links>
</mui:ModernTab>
</Grid>
The problem is I want to be able to create Item1, Item2.. programatically in C#. That is Link's here should be populated from a list which I will add dynamically. I have not used MVVM and searching for answers. Any suggestion would be appreciated.
This is what I have tried so far in Xaml
<mui:ModernTab Layout="List" Links="{Binding Path=IPList}">
In C#
public partial class ListOfIP : UserControl
{
public LinkCollection IPList { get; private set; }
public ListOfIP()
{
InitializeComponent();
IPList = new LinkCollection();
testMethod(IPList);
}
public void testMethod(LinkCollection IPList)
{
IPList.Add(new Link() { DisplayName = "IP1" });
IPList.Add(new Link() { DisplayName = "IP2" });
IPList.Add(new Link() { DisplayName = "IP3" });
}
}
Sorry if this is a stupid try, but I am still learning binding in WPF.