WPF:组合框数据模板
XAML:
<dxe:ComboBoxEdit x:Name="UserSelectComboBox" Margin="68.497,31.75,0,48.213"
Background= {DynamicResource TextBoxBackground}" Height="{DynamicResource
TextBoxHeight}" FontSize="{DynamicResource TextFontSize}"
HorizontalAlignment="Left" Width="149.333" Text="{Binding
SelectedItemValue, ElementName=UserSelectComboBox, Mode=OneWay}">
<dxe:ComboBoxEdit.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding UImages, Converter= {StaticResource
byteToImageConverter}}" Width="40" Height="40"/>
<TextBlock Text="{Binding UId}" Margin="5,0,0,0"/>
</StackPanel>
</DataTemplate>
</dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>
我正在使用 DevExpress ComboBox。当我选择组合框中的任何项目时,其文本将显示 Procesta.CvServer.Class.Propertys.UserTeamView 这是我的绑定源的名称。
我只想显示 UId。
XAML:
<dxe:ComboBoxEdit x:Name="UserSelectComboBox" Margin="68.497,31.75,0,48.213"
Background= {DynamicResource TextBoxBackground}" Height="{DynamicResource
TextBoxHeight}" FontSize="{DynamicResource TextFontSize}"
HorizontalAlignment="Left" Width="149.333" Text="{Binding
SelectedItemValue, ElementName=UserSelectComboBox, Mode=OneWay}">
<dxe:ComboBoxEdit.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Image Source="{Binding UImages, Converter= {StaticResource
byteToImageConverter}}" Width="40" Height="40"/>
<TextBlock Text="{Binding UId}" Margin="5,0,0,0"/>
</StackPanel>
</DataTemplate>
</dxe:ComboBoxEdit.ItemTemplate>
</dxe:ComboBoxEdit>
I am using DevExpress ComboBox. When I select any item in the ComboBox then its text shows Procesta.CvServer.Class.Propertys.UserTeamView which is my binding source's name.
I want to show only UId.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在将
Text
绑定到SelectedItemValue
。尝试绑定到SelectedItemValue.UId
。You are binding
Text
toSelectedItemValue
. Try binding toSelectedItemValue.UId
instead.