From eafb07899cd3af5db2ea733b51e299b0ca4e0421 Mon Sep 17 00:00:00 2001 From: ryanabaker <39451853+ryanabaker@users.noreply.github.com> Date: Sat, 19 Feb 2022 16:59:12 -0500 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20F-24=20Update=20Tyre=20mod?= =?UTF-8?q?ule=20to=20use=20only=20one=20DataGrid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- F1T/App.xaml | 1 + F1T/Core/BindingProxy.cs | 27 ++++++++++ F1T/F1T.csproj | 5 ++ F1T/MVVM/Views/Tyre/TyreOverlayView.xaml | 68 ++++++------------------ F1T/Themes/DataGridTheme.xaml | 26 +++++++++ 5 files changed, 76 insertions(+), 51 deletions(-) create mode 100644 F1T/Core/BindingProxy.cs create mode 100644 F1T/Themes/DataGridTheme.xaml diff --git a/F1T/App.xaml b/F1T/App.xaml index 72bbfd6..80ea512 100644 --- a/F1T/App.xaml +++ b/F1T/App.xaml @@ -18,6 +18,7 @@ + diff --git a/F1T/Core/BindingProxy.cs b/F1T/Core/BindingProxy.cs new file mode 100644 index 0000000..8e372c9 --- /dev/null +++ b/F1T/Core/BindingProxy.cs @@ -0,0 +1,27 @@ +using System.Windows; + +namespace F1T.Core +{ + // https://stackoverflow.com/questions/22073740/binding-visibility-for-datagridcolumn-in-wpf + public class BindingProxy : Freezable + { + #region Overrides of Freezable + + protected override Freezable CreateInstanceCore() + { + return new BindingProxy(); + } + + #endregion + + public object Data + { + get { return (object)GetValue(DataProperty); } + set { SetValue(DataProperty, value); } + } + + public static readonly DependencyProperty DataProperty = + DependencyProperty.Register("Data", typeof(object), + typeof(BindingProxy)); + } +} diff --git a/F1T/F1T.csproj b/F1T/F1T.csproj index 4781756..41895fd 100644 --- a/F1T/F1T.csproj +++ b/F1T/F1T.csproj @@ -138,6 +138,7 @@ + @@ -276,6 +277,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile diff --git a/F1T/MVVM/Views/Tyre/TyreOverlayView.xaml b/F1T/MVVM/Views/Tyre/TyreOverlayView.xaml index f52036e..fdeaf0d 100644 --- a/F1T/MVVM/Views/Tyre/TyreOverlayView.xaml +++ b/F1T/MVVM/Views/Tyre/TyreOverlayView.xaml @@ -8,70 +8,36 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:F1T.MVVM.Views.Tyre" xmlns:converters="clr-namespace:F1T.Converters" + xmlns:local="clr-namespace:F1T.MVVM.Views.Tyre" xmlns:converters="clr-namespace:F1T.Converters" xmlns:core="clr-namespace:F1T.Core" mc:Ignorable="d" Background="Transparent" MouseDown="Window_MouseDown" Height="125"> - - - - - - - - - + + - - - - - - - - - + GridLinesVisibility="None" + Style="{StaticResource DataGridTheme}"> + + + - + + - - - - - - - - - diff --git a/F1T/Themes/DataGridTheme.xaml b/F1T/Themes/DataGridTheme.xaml new file mode 100644 index 0000000..70f59a2 --- /dev/null +++ b/F1T/Themes/DataGridTheme.xaml @@ -0,0 +1,26 @@ + + + + + + + + \ No newline at end of file