我想在WPF ItemsControl中显示Customer对象列表.我为此创建了一个DataTemplate:
<DataTemplate DataType="{x:Type myNameSpace:Customer}">
<StackPanel Orientation="Horizontal" Margin="10">
<CheckBox"></CheckBox>
<TextBlock Text="{Binding Path=Number}"></TextBlock>
<TextBlock Text=" - "></TextBlock>
<TextBlock Text="{Binding Path=Name}"></TextBlock>
</StackPanel>
</DataTemplate>
Run Code Online (Sandbox Code Playgroud)
所以我想要的基本上是一个包含NUMBER - NAME的简单列表(带复选框).有没有办法可以在绑定部分直接连接数字和名称?
我想知道什么,找不到任何相关的主题.我有以下绑定:
Content="{x:Static resx:Resource.Form_OtherOption_Description}"
Run Code Online (Sandbox Code Playgroud)
这将在标签中放置一个字符串.我问自己的是,如果我可以在绑定之后添加":",而不是在代码中,只需在xaml中添加.标签代表"名称:".但添加":"作为绑定的一部分不是一种选择.
编辑
我在3.5版本工作
有什么建议.
提前致谢.