Skip to content

Commit 7f6e068

Browse files
Updates default behavior for ComboBoxAssist.ShowSelectedItem to display the selected in the ComboBox drop down list by default (#2459)
1 parent 11383a4 commit 7f6e068

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

MaterialDesignThemes.Wpf/ComboBoxAssist.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@ public static void SetClassicMode(DependencyObject element, bool value)
2525
=> element.SetValue(ClassicModeProperty, value);
2626

2727
/// <summary>
28-
/// By default the selected item is hidden from the drop down list, as per Material Design specifications.
29-
/// To revert to a more classic Windows desktop behaviour, and show the currently selected item again in the drop
30-
/// down, set this attached propety to true.
28+
/// By default the selected item is displayed in the drop down list, as per Material Design specifications.
29+
/// To change this to a behavior of hiding the selected item from the drop down list, set this attached property to false.
3130
/// </summary>
3231
public static readonly DependencyProperty ShowSelectedItemProperty = DependencyProperty.RegisterAttached(
3332
"ShowSelectedItem",
3433
typeof(bool),
3534
typeof(ComboBoxAssist),
36-
new FrameworkPropertyMetadata(false,
35+
new FrameworkPropertyMetadata(true,
3736
FrameworkPropertyMetadataOptions.AffectsRender | FrameworkPropertyMetadataOptions.Inherits));
3837

3938
public static bool GetShowSelectedItem(DependencyObject element)

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ComboBox.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,13 +843,13 @@
843843
</ControlTemplate>
844844

845845
<Style x:Key="MaterialDesignComboBox" TargetType="{x:Type ComboBox}">
846-
<Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="False" />
846+
<Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="True"/>
847847
<Setter Property="Background" Value="Transparent"/>
848848
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesignTextBoxBorder}"/>
849849
<Setter Property="BorderThickness" Value="0 0 0 1"/>
850850
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
851851
<Setter Property="Foreground" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type FrameworkElement}}, Path=(TextElement.Foreground)}"/>
852-
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemSelectedCollapsedStyle}" />
852+
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
853853
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
854854
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
855855
<Setter Property="Padding" Value="{x:Static wpf:Constants.TextBoxDefaultPadding}" />
@@ -873,8 +873,8 @@
873873
<Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" />
874874
</Trigger>
875875
<!-- designer prefers hard bool -->
876-
<Trigger Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource TrueValue}" >
877-
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemStyle}" />
876+
<Trigger Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="{StaticResource FalseValue}" >
877+
<Setter Property="ItemContainerStyle" Value="{StaticResource MaterialDesignComboBoxItemSelectedCollapsedStyle}" />
878878
</Trigger>
879879
</Style.Triggers>
880880
</Style>
@@ -887,7 +887,7 @@
887887

888888
<Style x:Key="MaterialDesignFilledComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource MaterialDesignFloatingHintComboBox}">
889889
<Setter Property="wpf:TextFieldAssist.TextFieldCornerRadius" Value="4,4,0,0" />
890-
<Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="False" />
890+
<Setter Property="wpf:ComboBoxAssist.ShowSelectedItem" Value="True"/>
891891
<Setter Property="VerticalContentAlignment" Value="Stretch" />
892892
<Setter Property="VerticalAlignment" Value="Stretch" />
893893
<Setter Property="Padding" Value="12,8,8,8" />

0 commit comments

Comments
 (0)