Quantcast
Channel: Looping through List
Viewing all articles
Browse latest Browse all 4

Looping through List

$
0
0

You can create the data binded ItemsControl object in XAML and connect its ItemsSource property to the GetChapters() method in C#. In the below XAML, the {Binding ChapterName} will need to be replaced with the list's property that is associated with the chapter name.

 

XAML:

        <ItemsControl x:Name="ChapterList">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <Button Width="100" Height="75" Content="{Binding Chapter_Name}" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>

 C#:

        ChapterList.ItemsSource = GetChapters();


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>