相关疑难解决方法(0)

连接字符串而不是使用TextBlocks堆栈

我想在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的简单列表(带复选框).有没有办法可以在绑定部分直接连接数字和名称?

.net wpf datatemplate

80
推荐指数
3
解决办法
5万
查看次数

在xaml中绑定后是否可以添加更多字符?

我想知道什么,找不到任何相关的主题.我有以下绑定:

Content="{x:Static resx:Resource.Form_OtherOption_Description}"
Run Code Online (Sandbox Code Playgroud)

这将在标签中放置一个字符串.我问自己的是,如果我可以在绑定之后添加":",而不是在代码中,只需在xaml中添加.标签代表"名称:".但添加":"作为绑定的一部分不是一种选择.

编辑

我在3.5版本工作

有什么建议.

提前致谢.

wpf xaml binding

23
推荐指数
4
解决办法
2万
查看次数

标签 统计

wpf ×2

.net ×1

binding ×1

datatemplate ×1

xaml ×1