added project for custom controls

master
Jonas Arnold 3 years ago
parent f869d217ac
commit f1054a534a
  1. 10
      MultiTerm.Wpf.CustomControl/AssemblyInfo.cs
  2. 54
      MultiTerm.Wpf.CustomControl/CustomControl1.cs
  3. 9
      MultiTerm.Wpf.CustomControl/MultiTerm.Wpf.CustomControl.csproj
  4. 17
      MultiTerm.Wpf.CustomControl/Themes/Generic.xaml
  5. 8
      MultiTerm.sln

@ -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)
)]

@ -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
{
/// <summary>
/// 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.
///
/// <MyNamespace:CustomControl1/>
///
/// </summary>
public class CustomControl1 : Control
{
static CustomControl1()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
}
}
}

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
</Project>

@ -0,0 +1,17 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MultiTerm.Wpf.CustomControl">
<Style TargetType="{x:Type local:CustomControl1}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl1}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiTerm.Wpf", "MultiTerm.
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiTerm.Core", "MultiTerm.Core\MultiTerm.Core.csproj", "{A4ED5CBB-954E-4F23-B9CB-8E30DF7B8F48}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MultiTerm.Core", "MultiTerm.Core\MultiTerm.Core.csproj", "{A4ED5CBB-954E-4F23-B9CB-8E30DF7B8F48}"
EndProject 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution 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}.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.ActiveCfg = Release|Any CPU
{26454190-1B60-46BE-8234-3207FB00D8A4}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

Loading…
Cancel
Save