I just wanted to define a custom DataTemplate
for my ListView
in order to show some data of a class. In an earlier project (c#, .net 3.5, wpf) I had something like this:
<Style x:Key="Custom_ComboBox_Style" TargetType="{x:Type ComboBox}">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock>
<TextBlock.Text>
<MultiBinding StringFormat="{}{0} {1} Members">
<Binding Path="Name"/>
<Binding Path="MemberCount"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</DataTemplate>
</Setter.Value>
</Setter>
Unfortunately this doesn't work in my current WinRT project :( I searched google and found out that WinRT has no MultiBinding
anymore. I couldn't find any solution to this problem until now. Any idea(s) how to solve this and achieve a similiar DataTemplate
like the one above?
Thanks in advance!
Try this:
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Name}" Margin="0,0,20,0" />
<TextBlock Text="{Binding MemberCount}" Margin="0,0,5,0" />
<TextBlock Text="Members" />
</StackPanel>
</DataTemplate>
</Setter.Value>
</Setter>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.