Init
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Xceed.Wpf.Toolkit
|
||||
{
|
||||
[TemplatePart( Name = PART_ActionButton, Type = typeof( Button ) )]
|
||||
public class SplitButton : DropDownButton
|
||||
{
|
||||
private const string PART_ActionButton = "PART_ActionButton";
|
||||
|
||||
#region Constructors
|
||||
|
||||
static SplitButton()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata( typeof( SplitButton ), new FrameworkPropertyMetadata( typeof( SplitButton ) ) );
|
||||
}
|
||||
|
||||
#endregion //Constructors
|
||||
|
||||
#region Base Class Overrides
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
Button = GetTemplateChild( PART_ActionButton ) as Button;
|
||||
}
|
||||
|
||||
#endregion //Base Class Overrides
|
||||
}
|
||||
}
|
||||
168
Src/Xceed.Wpf.Toolkit/SplitButton/Themes/Aero2.NormalColor.xaml
Normal file
168
Src/Xceed.Wpf.Toolkit/SplitButton/Themes/Aero2.NormalColor.xaml
Normal file
@@ -0,0 +1,168 @@
|
||||
<!--***********************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
**********************************************************************************-->
|
||||
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
|
||||
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
|
||||
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes"
|
||||
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Themes/Aero2/Common.xaml" />
|
||||
<ResourceDictionary Source="../../Themes/Aero2/Glyphs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||
|
||||
|
||||
<!-- =============================================================================== -->
|
||||
<!-- SplitButton -->
|
||||
<!-- =============================================================================== -->
|
||||
<conv:ThicknessSideRemovalConverter x:Key="ThicknessSideRemovalConverter"/>
|
||||
|
||||
<Style TargetType="{x:Type local:SplitButton}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1" />
|
||||
<Setter Property="IsTabStop"
|
||||
Value="False" />
|
||||
<Setter Property="HorizontalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalBackgroundKey}}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalOuterBorderKey}}" />
|
||||
<Setter Property="Padding"
|
||||
Value="3" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:SplitButton}">
|
||||
<Grid x:Name="MainGrid"
|
||||
SnapsToDevicePixels="True">
|
||||
<chrome:ButtonChrome x:Name="ControlChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="PART_ActionButton"
|
||||
Margin="0"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<Grid>
|
||||
<chrome:ButtonChrome x:Name="ActionButtonChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSideRemovalConverter}, ConverterParameter=2}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}"
|
||||
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_ActionButton}"
|
||||
RenderPressed="{Binding IsPressed, ElementName=PART_ActionButton}">
|
||||
<ContentPresenter Name="ActionButtonContent"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="true" />
|
||||
</chrome:ButtonChrome>
|
||||
</Grid>
|
||||
</Button>
|
||||
<ToggleButton x:Name="PART_ToggleButton"
|
||||
Grid.Column="1"
|
||||
IsTabStop="False"
|
||||
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
<Grid>
|
||||
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="1,0,1,0"
|
||||
RenderChecked="{TemplateBinding IsOpen}"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}"
|
||||
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_ToggleButton}"
|
||||
RenderPressed="{Binding IsPressed, ElementName=PART_ToggleButton}">
|
||||
<Grid x:Name="arrowGlyph"
|
||||
IsHitTestVisible="False"
|
||||
Margin="4,3,4,3">
|
||||
<Path x:Name="Arrow"
|
||||
Width="9"
|
||||
Height="5"
|
||||
Data="{StaticResource DownArrowGeometry}"
|
||||
Fill="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
|
||||
Margin="0,1,0,0"/>
|
||||
</Grid>
|
||||
</chrome:ButtonChrome>
|
||||
</Grid>
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</chrome:ButtonChrome>
|
||||
|
||||
<Popup x:Name="PART_Popup"
|
||||
HorizontalOffset="1"
|
||||
VerticalOffset="1"
|
||||
AllowsTransparency="True"
|
||||
StaysOpen="False"
|
||||
Placement="{TemplateBinding DropDownPosition}"
|
||||
Focusable="False"
|
||||
IsOpen="{Binding IsChecked, ElementName=PART_ToggleButton}">
|
||||
<!-- TODO: Create Popup Styles that can be reused on all popups in the toolkit-->
|
||||
<Border BorderThickness="1"
|
||||
Background="{StaticResource PanelBackgroundBrush}"
|
||||
BorderBrush="{StaticResource PopupDarkBorderBrush}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||
Content="{TemplateBinding DropDownContent}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="Fill"
|
||||
TargetName="Arrow"
|
||||
Value="#AFAFAF" />
|
||||
<Setter TargetName="ActionButtonChrome"
|
||||
Property="Foreground"
|
||||
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
194
Src/Xceed.Wpf.Toolkit/SplitButton/Themes/Generic.xaml
Normal file
194
Src/Xceed.Wpf.Toolkit/SplitButton/Themes/Generic.xaml
Normal file
@@ -0,0 +1,194 @@
|
||||
<!--***********************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
**********************************************************************************-->
|
||||
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
|
||||
xmlns:local="clr-namespace:Xceed.Wpf.Toolkit"
|
||||
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"
|
||||
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\Themes\Generic\Glyphs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||
|
||||
<LinearGradientBrush x:Key="ColorPickerDarkBorderBrush"
|
||||
EndPoint="0.5,1"
|
||||
StartPoint="0.5,0">
|
||||
<GradientStop Color="#FFA3AEB9"
|
||||
Offset="0" />
|
||||
<GradientStop Color="#FF8399A9"
|
||||
Offset="0.375" />
|
||||
<GradientStop Color="#FF718597"
|
||||
Offset="0.375" />
|
||||
<GradientStop Color="#FF617584"
|
||||
Offset="1" />
|
||||
</LinearGradientBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="PopupBackgroundBrush"
|
||||
StartPoint="0,0"
|
||||
EndPoint="0,1">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStopCollection>
|
||||
<GradientStop Offset="0"
|
||||
Color="#FFffffff" />
|
||||
<GradientStop Offset="1"
|
||||
Color="#FFE8EBED" />
|
||||
</GradientStopCollection>
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
<!-- =============================================================================== -->
|
||||
<!-- SplitButton -->
|
||||
<!-- =============================================================================== -->
|
||||
<conv:ThicknessSideRemovalConverter x:Key="ThicknessSideRemovalConverter" />
|
||||
|
||||
<Style TargetType="{x:Type local:SplitButton}">
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1" />
|
||||
<Setter Property="IsTabStop"
|
||||
Value="False" />
|
||||
<Setter Property="HorizontalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Background"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalBackgroundKey}}" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ButtonNormalOuterBorderKey}}" />
|
||||
<Setter Property="Padding"
|
||||
Value="3" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:SplitButton}">
|
||||
<Grid x:Name="MainGrid"
|
||||
SnapsToDevicePixels="True">
|
||||
<chrome:ButtonChrome x:Name="ControlChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}"
|
||||
CornerRadius="2.75">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="PART_ActionButton"
|
||||
Margin="0"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Padding="{TemplateBinding Padding}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<Grid>
|
||||
<chrome:ButtonChrome x:Name="ActionButtonChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
BorderThickness="{Binding BorderThickness, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource ThicknessSideRemovalConverter}, ConverterParameter=2}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
CornerRadius="2.75, 0, 0, 2.75"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}"
|
||||
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_ActionButton}"
|
||||
RenderPressed="{Binding IsPressed, ElementName=PART_ActionButton}">
|
||||
<ContentPresenter Name="ActionButtonContent"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
RecognizesAccessKey="true" />
|
||||
</chrome:ButtonChrome>
|
||||
</Grid>
|
||||
</Button>
|
||||
<ToggleButton x:Name="PART_ToggleButton"
|
||||
Grid.Column="1"
|
||||
IsTabStop="False"
|
||||
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
||||
IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}">
|
||||
<ToggleButton.Template>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<ContentPresenter />
|
||||
</ControlTemplate>
|
||||
</ToggleButton.Template>
|
||||
<Grid>
|
||||
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="1,0,1,0"
|
||||
CornerRadius="0, 2.75, 2.75, 0"
|
||||
RenderChecked="{TemplateBinding IsOpen}"
|
||||
RenderEnabled="{TemplateBinding IsEnabled}"
|
||||
RenderMouseOver="{Binding IsMouseOver, ElementName=PART_ToggleButton}"
|
||||
RenderPressed="{Binding IsPressed, ElementName=PART_ToggleButton}">
|
||||
<Grid x:Name="arrowGlyph"
|
||||
IsHitTestVisible="False"
|
||||
Margin="4,3,4,3">
|
||||
<Path x:Name="Arrow"
|
||||
Width="9"
|
||||
Height="5"
|
||||
Data="{StaticResource DownArrowGeometry}"
|
||||
Fill="#FF000000"
|
||||
Margin="0,1,0,0"/>
|
||||
</Grid>
|
||||
</chrome:ButtonChrome>
|
||||
</Grid>
|
||||
</ToggleButton>
|
||||
</Grid>
|
||||
</chrome:ButtonChrome>
|
||||
|
||||
<Popup x:Name="PART_Popup"
|
||||
HorizontalOffset="1"
|
||||
VerticalOffset="1"
|
||||
AllowsTransparency="True"
|
||||
StaysOpen="False"
|
||||
Placement="{TemplateBinding DropDownPosition}"
|
||||
Focusable="False"
|
||||
IsOpen="{Binding IsChecked, ElementName=PART_ToggleButton}">
|
||||
<!-- TODO: Create Popup Styles that can be reused on all popups in the toolkit-->
|
||||
<Border BorderThickness="1"
|
||||
Background="{StaticResource PopupBackgroundBrush}"
|
||||
BorderBrush="{StaticResource ColorPickerDarkBorderBrush}"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}">
|
||||
<ScrollViewer x:Name="DropDownScrollViewer"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<ContentPresenter x:Name="PART_ContentPresenter"
|
||||
Content="{TemplateBinding DropDownContent}" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled"
|
||||
Value="False">
|
||||
<Setter Property="Fill"
|
||||
TargetName="Arrow"
|
||||
Value="#AFAFAF" />
|
||||
<Setter Property="Foreground"
|
||||
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user