From a7d289f91c0ddafecc1247fc4569fd2ac5a931a8 Mon Sep 17 00:00:00 2001 From: Jonas Arnold Date: Thu, 6 Apr 2023 20:40:56 +0200 Subject: [PATCH] added CustomControl ExtendedTabControl, imported original TabControl theme --- ...ustomControl1.cs => ExtendedTabControl.cs} | 28 +++----- .../Themes/ExtendedTabControl.xaml | 71 +++++++++++++++++++ .../Themes/Generic.xaml | 17 ----- 3 files changed, 79 insertions(+), 37 deletions(-) rename MultiTerm.Wpf.CustomControl/{CustomControl1.cs => ExtendedTabControl.cs} (54%) create mode 100644 MultiTerm.Wpf.CustomControl/Themes/ExtendedTabControl.xaml delete mode 100644 MultiTerm.Wpf.CustomControl/Themes/Generic.xaml diff --git a/MultiTerm.Wpf.CustomControl/CustomControl1.cs b/MultiTerm.Wpf.CustomControl/ExtendedTabControl.cs similarity index 54% rename from MultiTerm.Wpf.CustomControl/CustomControl1.cs rename to MultiTerm.Wpf.CustomControl/ExtendedTabControl.cs index 851dc35..edcfc7e 100644 --- a/MultiTerm.Wpf.CustomControl/CustomControl1.cs +++ b/MultiTerm.Wpf.CustomControl/ExtendedTabControl.cs @@ -1,17 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; namespace MultiTerm.Wpf.CustomControl { @@ -22,33 +10,33 @@ namespace MultiTerm.Wpf.CustomControl /// Add this XmlNamespace attribute to the root element of the markup file where it is /// to be used: /// - /// xmlns:MyNamespace="clr-namespace:MultiTerm.Wpf.CustomControl" + /// xmlns:MyNamespace="clr-namespace:MultiTerm.Wpf.Controls" /// /// /// Step 1b) Using this custom control in a XAML file that exists in a different project. /// Add this XmlNamespace attribute to the root element of the markup file where it is /// to be used: /// - /// xmlns:MyNamespace="clr-namespace:MultiTerm.Wpf.CustomControl;assembly=MultiTerm.Wpf.CustomControl" + /// xmlns:MyNamespace="clr-namespace:MultiTerm.Wpf.Controls;assembly=MultiTerm.Wpf.Controls" /// /// You will also need to add a project reference from the project where the XAML file lives /// to this project and Rebuild to avoid compilation errors: /// /// Right click on the target project in the Solution Explorer and - /// "Add Reference"->"Projects"->[Select this project] + /// "Add Reference"->"Projects"->[Browse to and select this project] /// /// /// Step 2) /// Go ahead and use your control in the XAML file. /// - /// + /// /// /// - public class CustomControl1 : Control + public class ExtendedTabControl : TabControl { - static CustomControl1() + static ExtendedTabControl() { - DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1))); + DefaultStyleKeyProperty.OverrideMetadata(typeof(ExtendedTabControl), new FrameworkPropertyMetadata(typeof(ExtendedTabControl))); } } } diff --git a/MultiTerm.Wpf.CustomControl/Themes/ExtendedTabControl.xaml b/MultiTerm.Wpf.CustomControl/Themes/ExtendedTabControl.xaml new file mode 100644 index 0000000..2623823 --- /dev/null +++ b/MultiTerm.Wpf.CustomControl/Themes/ExtendedTabControl.xaml @@ -0,0 +1,71 @@ + + + + + + diff --git a/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml b/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml deleted file mode 100644 index 968633b..0000000 --- a/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml +++ /dev/null @@ -1,17 +0,0 @@ - - -