2016-11-15 43 views
0

我有ComboboxItem中有多行的组合框。但我想当我选择项目只显示一行。请参见图示: enter image description hereWPF Combobox - 编辑选定的文本

这是我的代码:

<ComboBox ItemsSource="{Binding Path=QuickSelectionDates}" SelectedValuePath="Value" Width="110" Height="20" VerticalContentAlignment="Center" 
SelectedValue="{Binding Path=QuickSelectionDate, UpdateSourceTrigger=PropertyChanged}" Name="QuickSelectionDatesCombo" 
         Margin="5 0 0 0" IsEnabled="{Binding IsEnabled, UpdateSourceTrigger=PropertyChanged}"> 
       <ComboBox.ItemTemplate> 
        <DataTemplate DataType="{x:Type library:ValueItem}"> 
         <StackPanel Orientation="Vertical"> 
          <TextBlock Text="{Binding Description}" FontSize="11" FontWeight="Bold"/> 
          <TextBlock Text="{Binding AdditionalDesctiption}" FontSize="10"/> <!--DATE RANGE (second line)--> 
         </StackPanel> 
        </DataTemplate> 
       </ComboBox.ItemTemplate> 
       <i:Interaction.Triggers> 
        <i:EventTrigger EventName="SelectionChanged"> 
         <i:InvokeCommandAction Command="{Binding QuickSelectionDateCommand}" 
               CommandParameter="{Binding ElementName=QuickSelectionDatesCombo, Path=SelectedValue}"/> 
        </i:EventTrigger> 
       </i:Interaction.Triggers> 
      </ComboBox> 

感谢您的帮助

+0

你有足够的信息来回答这个问题吗? – bluray

回答

0

已存在,其具有中首先显示的组合框的值的事件或属性?我需要选择值显示后只有一行。 谢谢你的回答