Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] clear type stuff #1537

Merged
merged 5 commits into from
Sep 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions MahApps.Metro/Microsoft.Windows.Shell/WindowChromeWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,15 +1125,28 @@ private void _ExtendGlassFrame()
// Ensure standard HWND background painting when DWM isn't enabled.
if (!NativeMethods.DwmIsCompositionEnabled())
{
_hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor;
// Apply the transparent background to the HWND for disabled DwmIsComposition too
// but only if the window has the flag AllowsTransparency turned on
if (_window.AllowsTransparency)
{
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
}
else
{
_hwndSource.CompositionTarget.BackgroundColor = SystemColors.WindowColor;
}
}
else
{
// This makes the glass visible at a Win32 level so long as nothing else is covering it.
// The Window's Background needs to be changed independent of this.

// Apply the transparent background to the HWND
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
// but only if the window has the flag AllowsTransparency turned on
if (_window.AllowsTransparency)
{
_hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
}

// Thickness is going to be DIPs, need to convert to system coordinates.
Thickness deviceGlassThickness = DpiHelper.LogicalThicknessToDevice(_chromeInfo.GlassFrameThickness);
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Accents/BaseDark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Accents/BaseLight.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
1 change: 1 addition & 0 deletions MahApps.Metro/Styles/Colors.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="ContextMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="SubMenuBackgroundBrush" Color="{StaticResource WhiteColor}" />
<SolidColorBrush x:Key="MenuItemBackgroundBrush" Color="{StaticResource WhiteColor}" />

<SolidColorBrush x:Key="ContextMenuBorderBrush" Color="{StaticResource BlackColor}" />
<SolidColorBrush x:Key="SubMenuBorderBrush" Color="{StaticResource BlackColor}" />
Expand Down
24 changes: 14 additions & 10 deletions MahApps.Metro/Styles/Controls.ComboBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -290,28 +290,30 @@
Opacity="0" />
<!-- AllowsTransparency="true" fixes the redraw problem under windows vista/7 with a selected non aero theme -->
<Popup x:Name="PART_Popup"
AllowsTransparency="true"
AllowsTransparency="True"
Focusable="False"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{Binding MaxDropDownHeight, RelativeSource={RelativeSource TemplatedParent}}"
Placement="Bottom">
<Border x:Name="PopupBorder"
Effect="{DynamicResource DropShadowBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
Height="Auto"
BorderBrush="{DynamicResource ComboBoxPopupBrush}"
Background="{DynamicResource WhiteBrush}">
<Grid>
<Border x:Name="PopupBorder"
Effect="{DynamicResource DropShadowBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
Height="Auto"
BorderBrush="{DynamicResource ComboBoxPopupBrush}"
Background="{DynamicResource WhiteBrush}">
</Border>
<ScrollViewer x:Name="DropDownScrollViewer"
BorderThickness="0"
Margin="2"
Padding="1">
<ItemsPresenter x:Name="ItemsPresenter"
KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Border>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
Expand Down Expand Up @@ -381,8 +383,10 @@
Value="Left" />
<Setter Property="VerticalContentAlignment"
Value="Top" />
<Setter Property="RenderOptions.ClearTypeHint"
Value="Enabled" />
<Setter Property="Background"
Value="{DynamicResource TransparentWhiteBrush}" />
Value="{DynamicResource WhiteBrush}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Template">
Expand Down
4 changes: 3 additions & 1 deletion MahApps.Metro/Styles/Controls.ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@
Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
<Setter Property="RenderOptions.ClearTypeHint"
Value="Enabled" />
<Setter Property="Background"
Value="Transparent" />
Value="{DynamicResource MenuItemBackgroundBrush}" />
<Setter Property="ScrollViewer.PanningMode"
Value="Both" />
<Setter Property="Stylus.IsFlicksEnabled"
Expand Down