开发者

WPF: ComboBox DataTemplate

开发者 https://www.devze.com 2023-04-10 01:52 出处:网络
XAML: <dxe:ComboBoxEdit x:Name=\"UserSelectComboBox\" Margin=\"68.497,31.75,0,48.213\" Background={DynamicResource TextBoxBackground}\" Height=\"{DynamicResource

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.

WPF: ComboBox DataTemplate

I want to show only UId.


You are binding Text to SelectedItemValue. Try binding to SelectedItemValue.UId instead.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号