win10类型按钮
来源:互联网 发布:网络远程监控软件 编辑:程序博客网 时间:2024/06/06 17:52
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Transfer4UI.ItemControl">
<ControlTemplate x:Key="MinizeButonTemplate" TargetType="{x:Type local:EmbededButton}">
<Border BorderThickness="1" Background="{TemplateBinding Background}" >
<Grid x:Name="embedButtonGrid" ToolTip="{TemplateBinding ToolTip}" >
<Rectangle Fill="White" Width="10" Height="3" SnapsToDevicePixels="True"></Rectangle>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="embedButtonGrid" Property="Background" Value="Black"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="embedButtonGrid" Property="Background" Value="white"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Transfer4UI.ItemControl">
<ControlTemplate x:Key="MinizeButonTemplate" TargetType="{x:Type local:EmbededButton}">
<Border BorderThickness="1" Background="{TemplateBinding Background}" >
<Grid x:Name="embedButtonGrid" ToolTip="{TemplateBinding ToolTip}" >
<Rectangle Fill="White" Width="10" Height="3" SnapsToDevicePixels="True"></Rectangle>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="embedButtonGrid" Property="Background" Value="Black"/>
</Trigger>
<Trigger Property="IsPressed" Value="true">
<Setter TargetName="embedButtonGrid" Property="Background" Value="white"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<ControlTemplate x:Key="ResizeWindowRadioButtonTemplate" TargetType="{x:Type local:EmbedCheckBox}">
<Border Background="{TemplateBinding Background}" >
<Grid x:Name="ResizeWinGrid" ToolTip="{TemplateBinding ToolTip}">
<Canvas ClipToBounds="True">
<Border Canvas.Left="4" Canvas.Top="1" BorderBrush="White" BorderThickness="1" Width="8" Height="6" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
<Border Background="{TemplateBinding Background}" >
<Grid x:Name="ResizeWinGrid" ToolTip="{TemplateBinding ToolTip}">
<Canvas ClipToBounds="True">
<Border Canvas.Left="4" Canvas.Top="1" BorderBrush="White" BorderThickness="1" Width="8" Height="6" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
<Border Canvas.Left="0" Canvas.Top="4" BorderBrush="White" BorderThickness="1" Width="8" Height="6" Background="{TemplateBinding Background}" SnapsToDevicePixels="True" />
</Canvas>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="Black"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="white"/>
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="{Binding Path=Background, ElementName=ResizeWinGrid}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Canvas>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="Black"/>
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="white"/>
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="ResizeWinGrid" Property="Background" Value="{Binding Path=Background, ElementName=ResizeWinGrid}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style TargetType="{x:Type local:EmbededButton}" BasedOn="{x:Null}">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template" Value="{StaticResource MinizeButonTemplate}" />
</Style>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template" Value="{StaticResource MinizeButonTemplate}" />
</Style>
<Style TargetType="{x:Type local:EmbedCheckBox}" BasedOn="{x:Null}">
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template" Value="{StaticResource ResizeWindowRadioButtonTemplate}" />
</Style>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="Template" Value="{StaticResource ResizeWindowRadioButtonTemplate}" />
</Style>
<Style x:Key="ControlMinButton" TargetType="{x:Type local:EmbededButton}" BasedOn="{StaticResource {x:Type local:EmbededButton}}"/>
<Style x:Key="WinResizeButton" TargetType="{x:Type local:EmbedCheckBox}" BasedOn="{StaticResource {x:Type local:EmbedCheckBox}}"/>
</ResourceDictionary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
namespace Transfer4UI.ItemControl
{
public class EmbededButton:Button
{
static EmbededButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbededButton), new FrameworkPropertyMetadata(typeof(EmbededButton)));
}
}
{
public class EmbededButton:Button
{
static EmbededButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbededButton), new FrameworkPropertyMetadata(typeof(EmbededButton)));
}
}
public class EmbededRadioButton:RadioButton
{
static EmbededRadioButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbededRadioButton), new FrameworkPropertyMetadata(typeof(EmbededRadioButton)));
}
}
{
static EmbededRadioButton()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbededRadioButton), new FrameworkPropertyMetadata(typeof(EmbededRadioButton)));
}
}
public class EmbedCheckBox:CheckBox
{
static EmbedCheckBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbedCheckBox), new FrameworkPropertyMetadata(typeof(EmbedCheckBox)));
}
}
}
{
static EmbedCheckBox()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(EmbedCheckBox), new FrameworkPropertyMetadata(typeof(EmbedCheckBox)));
}
}
}
0 0
- win10类型按钮
- win10 uwp 圆角按钮
- win10 uwp 获取按钮鼠标左键按下
- win10 uwp 按下等待按钮
- easyui框架按钮的类型
- win10 自适配分栏 和 加返回按钮
- (Android Studio 3.0 + Win10)SDK Manager按钮能用,AVD Manager按钮不能用
- win10
- win10
- win10
- win10
- win10
- win10
- win10
- win10
- win10
- 从win10系统到win7,再装回win10,以及卸载更新各种同类型键盘驱动
- win10提示 磁盘包含不是“PARTITION_BASIC_DATA_GUID"类型的分区
- SDUT 2165 Crack Mathmen(快速幂)山东省第二届ACM大学生程序设计竞赛
- 图片加载之Glide使用总结
- 查询MYSQL和查询HBASE速度比较
- vtk实战(二)——点到直线的距离
- Leetcode 25. Reverse Nodes in k-Group
- win10类型按钮
- Maven(1) -- install
- tcpcopy浅谈
- 多线程 《深入浅出 Java Concurrency》目录
- c++实验4——输出星号图
- geekband android #5 第八周分享(多线程)
- ECMAScript运算符_关系运算符&等性运算符&条件运算符&赋值运算符&逗号运算符
- HDU1576 A/B
- WebView的设置