WPF: ComboBox DataTemplate
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>
</D开发者_运维问答ataTemplate>
</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.
You are binding Text
to SelectedItemValue
. Try binding to SelectedItemValue.UId
instead.
精彩评论