diff --git a/MultiTerm.Wpf.CustomControl/AssemblyInfo.cs b/MultiTerm.Wpf.CustomControl/AssemblyInfo.cs new file mode 100644 index 0000000..8b5504e --- /dev/null +++ b/MultiTerm.Wpf.CustomControl/AssemblyInfo.cs @@ -0,0 +1,10 @@ +using System.Windows; + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/MultiTerm.Wpf.CustomControl/CustomControl1.cs b/MultiTerm.Wpf.CustomControl/CustomControl1.cs new file mode 100644 index 0000000..851dc35 --- /dev/null +++ b/MultiTerm.Wpf.CustomControl/CustomControl1.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +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 +{ + /// + /// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file. + /// + /// Step 1a) Using this custom control in a XAML file that exists in the current 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" + /// + /// + /// 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" + /// + /// 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] + /// + /// + /// Step 2) + /// Go ahead and use your control in the XAML file. + /// + /// + /// + /// + public class CustomControl1 : Control + { + static CustomControl1() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1))); + } + } +} diff --git a/MultiTerm.Wpf.CustomControl/MultiTerm.Wpf.CustomControl.csproj b/MultiTerm.Wpf.CustomControl/MultiTerm.Wpf.CustomControl.csproj new file mode 100644 index 0000000..c6ee76c --- /dev/null +++ b/MultiTerm.Wpf.CustomControl/MultiTerm.Wpf.CustomControl.csproj @@ -0,0 +1,9 @@ + + + + net6.0-windows + enable + true + + + diff --git a/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml b/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml new file mode 100644 index 0000000..968633b --- /dev/null +++ b/MultiTerm.Wpf.CustomControl/Themes/Generic.xaml @@ -0,0 +1,17 @@ + + + diff --git a/MultiTerm.sln b/MultiTerm.sln index 7ccc151..d80e7c1 100644 --- a/MultiTerm.sln +++ b/MultiTerm.sln @@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiTerm.Wpf", "MultiTerm. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiTerm.Core", "MultiTerm.Core\MultiTerm.Core.csproj", "{A4ED5CBB-954E-4F23-B9CB-8E30DF7B8F48}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{26454190-1B60-46BE-8234-3207FB00D8A4}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "Common\Common.csproj", "{26454190-1B60-46BE-8234-3207FB00D8A4}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MultiTerm.Wpf.CustomControl", "MultiTerm.Wpf.CustomControl\MultiTerm.Wpf.CustomControl.csproj", "{9E308B45-2F71-44DD-A640-40953FD644D7}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,6 +29,10 @@ Global {26454190-1B60-46BE-8234-3207FB00D8A4}.Debug|Any CPU.Build.0 = Debug|Any CPU {26454190-1B60-46BE-8234-3207FB00D8A4}.Release|Any CPU.ActiveCfg = Release|Any CPU {26454190-1B60-46BE-8234-3207FB00D8A4}.Release|Any CPU.Build.0 = Release|Any CPU + {9E308B45-2F71-44DD-A640-40953FD644D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E308B45-2F71-44DD-A640-40953FD644D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E308B45-2F71-44DD-A640-40953FD644D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E308B45-2F71-44DD-A640-40953FD644D7}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE