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

Wpf: Allow DataGrid and Window background to be styled #2685

Merged
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
1 change: 0 additions & 1 deletion src/Eto.Wpf/Forms/ColorDialogHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public bool UsingAlphaChannel
public XceedColorDialog()
{
canvas = new xwt.ColorCanvas();
SetResourceReference(BackgroundProperty, sw.SystemColors.ControlBrushKey);

var doneButton = new swc.Button { Content = "OK", IsDefault = true, MinWidth = 80, Margin = new sw.Thickness(5) };
doneButton.Click += doneButton_Click;
Expand Down
3 changes: 1 addition & 2 deletions src/Eto.Wpf/Forms/Controls/GridHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public EtoDataGrid()
Loaded += EtoDataGrid_Loaded;
}

private void EtoDataGrid_Loaded(object sender, sw.RoutedEventArgs e)
private void EtoDataGrid_Loaded(object sender, sw.RoutedEventArgs e)
{
var scp = this.FindChild<swc.ScrollContentPresenter>();
if (scp != null) scp.RequestBringIntoView += OnRequestBringIntoView;
Expand Down Expand Up @@ -146,7 +146,6 @@ protected GridHandler()
EnableColumnVirtualization = true,
EnableRowVirtualization = true,
};
Control.SetResourceReference(swc.Control.BackgroundProperty, sw.SystemColors.WindowBrushKey);
}

protected ColumnCollection Columns { get; private set; }
Expand Down
1 change: 0 additions & 1 deletion src/Eto.Wpf/Forms/Controls/TreeGridViewHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ protected override void Initialize()
{
base.Initialize();
controller = new TreeController { Handler = this };
Control.SetResourceReference(swc.Panel.BackgroundProperty, sw.SystemColors.WindowBrushKey);
Control.PreviewKeyDown += Control_PreviewKeyDown;
}

Expand Down
8 changes: 6 additions & 2 deletions src/Eto.Wpf/Forms/WpfWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ static class WpfWindow
internal static readonly object Icon_Key = new object();
internal static readonly object ShowSystemMenu_Key = new object();
}

public class EtoWindowContent : swc.DockPanel
{

}

public abstract class WpfWindow<TControl, TWidget, TCallback> : WpfPanel<TControl, TWidget, TCallback>, Window.IHandler, IWpfWindow, IInputBindingHost
where TControl : sw.Window
Expand Down Expand Up @@ -99,7 +104,7 @@ protected override void Initialize()
{
if (IsAttached)
return;
content = new swc.DockPanel();
content = new EtoWindowContent();
UseShellDropManager = true;

base.Initialize();
Expand All @@ -109,7 +114,6 @@ protected override void Initialize()
main = new swc.DockPanel();
menuHolder = new swc.ContentControl { IsTabStop = false };
toolBarHolder = new swc.ContentControl { IsTabStop = false };
content.SetResourceReference(swc.Panel.BackgroundProperty, sw.SystemColors.ControlBrushKey);
swc.DockPanel.SetDock(menuHolder, swc.Dock.Top);
swc.DockPanel.SetDock(toolBarHolder, swc.Dock.Top);
main.Children.Add(menuHolder);
Expand Down
14 changes: 14 additions & 0 deletions src/Eto.Wpf/themes/controls/DataGrid.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Eto.Wpf.CustomControls.TreeGridView"
xmlns:efc="clr-namespace:Eto.Wpf.Forms.Controls"
xmlns:e="clr-namespace:Eto.Wpf"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes;assembly=Xceed.Wpf.Toolkit"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit">

<Style TargetType="efc:EtoDataGrid">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
</Style>

</ResourceDictionary>
15 changes: 15 additions & 0 deletions src/Eto.Wpf/themes/controls/Window.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Eto.Wpf.CustomControls.TreeGridView"
xmlns:efc="clr-namespace:Eto.Wpf.Forms.Controls"
xmlns:e="clr-namespace:Eto.Wpf"
xmlns:ef="clr-namespace:Eto.Wpf.Forms"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes;assembly=Xceed.Wpf.Toolkit"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit">

<Style TargetType="ef:EtoWindowContent">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Style>

</ResourceDictionary>
15 changes: 15 additions & 0 deletions src/Eto.Wpf/themes/controls/XceedColorDialog.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Eto.Wpf.CustomControls.TreeGridView"
xmlns:efc="clr-namespace:Eto.Wpf.Forms.Controls"
xmlns:e="clr-namespace:Eto.Wpf"
xmlns:ef="clr-namespace:Eto.Wpf.Forms"
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes;assembly=Xceed.Wpf.Toolkit"
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit">

<Style TargetType="ef:XceedColorDialog">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
</Style>

</ResourceDictionary>
8 changes: 6 additions & 2 deletions src/Eto.Wpf/themes/generic.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
xmlns:s="clr-namespace:System;assembly=mscorlib">

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/wpftoolkit/ButtonSpinner.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/WatermarkTextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/DataGrid.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/SearchTextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/WatermarkTextBox.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/Window.xaml" />
<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/controls/XceedColorDialog.xaml" />

<ResourceDictionary Source="pack://application:,,,/Eto.Wpf;Component/themes/wpftoolkit/ButtonSpinner.xaml" />
</ResourceDictionary.MergedDictionaries>

<Style TargetType="{x:Type r:TreeToggleButton}">
Expand Down
Loading