This post would have been the answer but it only works in WPF. UWP and WinUI3 don't have Multibinding.
How do you make that code in UWP/WinUI3?
This post would have been the answer but it only works in WPF. UWP and WinUI3 don't have Multibinding.
How do you make that code in UWP/WinUI3?
(Multi)Binding a List to a TextBlock in UWP or WinUI3
As Johnny Westlake said you could use x:bind method to binding a list to a TextBlock
. For example, Use String.Format
method to format list then render in the TextBlock
. For more please refer this document.
<Page
xmlns:sys="using:System"
xmlns:local="using:MyNamespace">
<ListView ItemsSource="{x:Bind Items}">
<ListView.ItemTemplate>
<DataTemplate x:DataType="local:Item">
<TextBlock Text="{x:Bind sys:String.Format(x:Null, '{0} is now available in {1}', FirstName, LastName)}"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Page>
I believe that sys:String.Format is winui3 with the UWP interface, but if you are using the newer winui3 "Microsoft:" (rather than "Windows:") Win App SDK interface, it is not supported. What is the best way to achieve equivalent under the newest interface, not the UWP interface?