0
我有ComboboxItem中有多行的組合框。但我想當我選擇項目只顯示一行。請參見圖示: WPF 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>
感謝您的幫助
你有足夠的信息來回答這個問題嗎? – bluray