mirror of
https://github.com/ZuneDev/ZuneModdingHelper.git
synced 2026-07-27 13:12:21 -07:00
Add PathButton
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:zmhc="clr-namespace:ZuneModdingHelper.Controls">
|
||||||
|
|
||||||
|
<Style x:Key="DefaultPathButtonStyle" TargetType="zmhc:PathButton">
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="zmhc:PathButton">
|
||||||
|
<Border Background="Transparent" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
|
||||||
|
<Grid>
|
||||||
|
<Viewbox Margin="{TemplateBinding Padding}">
|
||||||
|
<Path x:Name="Icon" Fill="#999999" Data="{TemplateBinding PathData}"/>
|
||||||
|
</Viewbox>
|
||||||
|
<ContentPresenter
|
||||||
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsMouseOver" Value="True">
|
||||||
|
<Setter TargetName="Icon" Property="Fill" Value="Black"/>
|
||||||
|
</Trigger>
|
||||||
|
<Trigger Property="IsPressed" Value="True">
|
||||||
|
<Setter TargetName="Icon" Property="Fill" Value="#CCCCCC"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="zmhc:PathButton" BasedOn="{StaticResource DefaultPathButtonStyle}"/>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
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 ZuneModdingHelper.Controls;
|
||||||
|
|
||||||
|
public class PathButton : Button
|
||||||
|
{
|
||||||
|
static PathButton()
|
||||||
|
{
|
||||||
|
DefaultStyleKeyProperty.OverrideMetadata(typeof(PathButton), new FrameworkPropertyMetadata(typeof(PathButton)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Geometry PathData
|
||||||
|
{
|
||||||
|
get => (Geometry)GetValue(PathDataProperty);
|
||||||
|
set => SetValue(PathDataProperty, value);
|
||||||
|
}
|
||||||
|
public static readonly DependencyProperty PathDataProperty = DependencyProperty.Register(
|
||||||
|
nameof(PathData), typeof(Geometry), typeof(PathButton), new PropertyMetadata(null));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user