添加项目文件。
This commit is contained in:
33
Wpf.Ui.Extend/Controls/ColorZone/ColorZone.xaml
Normal file
33
Wpf.Ui.Extend/Controls/ColorZone/ColorZone.xaml
Normal file
@@ -0,0 +1,33 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:exc="clr-namespace:Wpf.Ui.Extend.Controls">
|
||||
|
||||
|
||||
<Style TargetType="{x:Type exc:ColorZone}">
|
||||
<Setter Property="Border.CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type exc:ColorZone}">
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<ContentPresenter
|
||||
x:Name="ContentPresenter"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding ContentControl.Content}"
|
||||
ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}"
|
||||
ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentControl.ContentTemplateSelector}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
34
Wpf.Ui.Extend/Controls/ColorZone/ColorZone.xaml.cs
Normal file
34
Wpf.Ui.Extend/Controls/ColorZone/ColorZone.xaml.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
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 Wpf.Ui.Extend.Controls;
|
||||
|
||||
public class ColorZone : ContentControl
|
||||
{
|
||||
static ColorZone()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata(typeof(ColorZone), new FrameworkPropertyMetadata(typeof(ColorZone)));
|
||||
}
|
||||
|
||||
public CornerRadius CornerRadius
|
||||
{
|
||||
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
|
||||
set { SetValue(CornerRadiusProperty, value); }
|
||||
}
|
||||
|
||||
// Using a DependencyProperty as the backing store for CornerRadius. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty CornerRadiusProperty =
|
||||
DependencyProperty.Register(nameof(CornerRadius), typeof(CornerRadius), typeof(ColorZone), new PropertyMetadata(new CornerRadius(0)));
|
||||
}
|
||||
Reference in New Issue
Block a user