Binding is an ideal technique for displaying dybanic content in to application in WPF. Todays tips is about how to bind list/array elements in a C# WPF app.
In my C# code I have specified the binding as follows.
List<string> myvalues = new List<string>() { "May 2020", "May", "Monday", "25/May/2020" }; txt_month.DataContext=myvalues;
I wan t to bind the second element, that means second element in the list (1th). So lets udjust the xaml bining
<TextBlock FontSize="14" x:Name="txt_month" Text="{Binding [1]}" Foreground="Bisque"/>
We have used ‘[ ]’ to specify the element. If you have array of object you can use [ ] .<member> to specify the public member of the class too.
Great.
LikeLike
You are welcome
LikeLike