Permalink
Browse files

Fix possible System.Windows.Data warning for ComboBoxItem, if a Combo…

…Box is inside a ContentControl.

  System.Windows.Data Warning: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.ComboBox', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'ComboBoxItem' (Name=''); target property is 'ClearTypeHint' (type 'ClearTypeHint')
  • Loading branch information...
punker76 committed Aug 30, 2017
1 parent 6c936c2 commit 44c236374c2393f70338b4bdcc28050e9e7e03f4
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/MahApps.Metro/MahApps.Metro/Styles/Controls.ComboBox.xaml
@@ -604,7 +604,6 @@
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="MinHeight" Value="22" />
<Setter Property="Padding" Value="2" />
<Setter Property="RenderOptions.ClearTypeHint" Value="{Binding Path=(RenderOptions.ClearTypeHint), Mode=OneWay, FallbackValue=Auto, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}}" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
@@ -643,6 +642,11 @@
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsVisible" Value="True">
<Setter Property="RenderOptions.ClearTypeHint" Value="{Binding Path=(RenderOptions.ClearTypeHint), FallbackValue=Auto, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}}" />
</Trigger>
</Style.Triggers>
</Style>
</ResourceDictionary>

0 comments on commit 44c2363

Please sign in to comment.