Init
This commit is contained in:
BIN
Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Images/Notes16.png
Normal file
BIN
Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Images/Notes16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 601 B |
@@ -0,0 +1,288 @@
|
||||
/*************************************************************************************
|
||||
|
||||
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;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Xceed.Wpf.Toolkit.Core.Utilities;
|
||||
|
||||
namespace Xceed.Wpf.Toolkit
|
||||
{
|
||||
[TemplatePart( Name = PART_ResizeThumb, Type = typeof( Thumb ) )]
|
||||
[TemplatePart( Name = PART_TextBox, Type = typeof( TextBox ) )]
|
||||
[TemplatePart( Name = PART_DropDownButton, Type = typeof( ToggleButton ) )]
|
||||
public class MultiLineTextEditor : ContentControl
|
||||
{
|
||||
private const string PART_ResizeThumb = "PART_ResizeThumb";
|
||||
private const string PART_TextBox = "PART_TextBox";
|
||||
private const string PART_DropDownButton = "PART_DropDownButton";
|
||||
|
||||
#region Members
|
||||
|
||||
private Thumb _resizeThumb;
|
||||
private TextBox _textBox;
|
||||
private ToggleButton _toggleButton;
|
||||
|
||||
#endregion //Members
|
||||
|
||||
#region Properties
|
||||
|
||||
#region DropDownHeight
|
||||
public static readonly DependencyProperty DropDownHeightProperty = DependencyProperty.Register( "DropDownHeight", typeof( double ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( 150.0 ) );
|
||||
public double DropDownHeight
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( double )GetValue( DropDownHeightProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( DropDownHeightProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion DropDownHeight
|
||||
|
||||
#region DropDownWidth
|
||||
public static readonly DependencyProperty DropDownWidthProperty = DependencyProperty.Register( "DropDownWidth", typeof( double ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( 200.0 ) );
|
||||
public double DropDownWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( double )GetValue( DropDownWidthProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( DropDownWidthProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion DropDownWidth
|
||||
|
||||
#region IsOpen
|
||||
|
||||
public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register( "IsOpen", typeof( bool ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( false, OnIsOpenChanged ) );
|
||||
public bool IsOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( bool )GetValue( IsOpenProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( IsOpenProperty, value );
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnIsOpenChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
MultiLineTextEditor multiLineTextEditor = o as MultiLineTextEditor;
|
||||
if( multiLineTextEditor != null )
|
||||
multiLineTextEditor.OnIsOpenChanged( ( bool )e.OldValue, ( bool )e.NewValue );
|
||||
}
|
||||
|
||||
protected virtual void OnIsOpenChanged( bool oldValue, bool newValue )
|
||||
{
|
||||
// Focus the content of the popup, after its loaded
|
||||
Dispatcher.BeginInvoke(new Action(()=>_textBox.Focus()), DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
#endregion //IsOpen
|
||||
|
||||
#region IsSpellCheckEnabled
|
||||
public static readonly DependencyProperty IsSpellCheckEnabledProperty = DependencyProperty.Register( "IsSpellCheckEnabled", typeof( bool ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( false ) );
|
||||
public bool IsSpellCheckEnabled
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( bool )GetValue( IsSpellCheckEnabledProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( IsSpellCheckEnabledProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion IsSpellCheckEnabled
|
||||
|
||||
#region IsReadOnly
|
||||
public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register( "IsReadOnly", typeof( bool ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( false ) );
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( bool )GetValue( IsReadOnlyProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( IsReadOnlyProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion IsReadOnly
|
||||
|
||||
#region Text
|
||||
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof( string ), typeof( MultiLineTextEditor ), new FrameworkPropertyMetadata( String.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnTextChanged ) );
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( string )GetValue( TextProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( TextProperty, value );
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnTextChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
MultiLineTextEditor textEditor = o as MultiLineTextEditor;
|
||||
if( textEditor != null )
|
||||
textEditor.OnTextChanged( ( string )e.OldValue, ( string )e.NewValue );
|
||||
}
|
||||
|
||||
protected virtual void OnTextChanged( string oldValue, string newValue )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion //Text
|
||||
|
||||
#region TextAlignment
|
||||
public static readonly DependencyProperty TextAlignmentProperty = DependencyProperty.Register( "TextAlignment", typeof( TextAlignment ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( TextAlignment.Left ) );
|
||||
public TextAlignment TextAlignment
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( TextAlignment )GetValue( TextAlignmentProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( TextAlignmentProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion TextAlignment
|
||||
|
||||
#region TextWrapping
|
||||
public static readonly DependencyProperty TextWrappingProperty = DependencyProperty.Register( "TextWrapping", typeof( TextWrapping ), typeof( MultiLineTextEditor ), new UIPropertyMetadata( TextWrapping.NoWrap ) );
|
||||
public TextWrapping TextWrapping
|
||||
{
|
||||
get
|
||||
{
|
||||
return ( TextWrapping )GetValue( TextWrappingProperty );
|
||||
}
|
||||
set
|
||||
{
|
||||
SetValue( TextWrappingProperty, value );
|
||||
}
|
||||
}
|
||||
#endregion TextWrapping
|
||||
|
||||
#endregion //Properties
|
||||
|
||||
#region Constructors
|
||||
|
||||
static MultiLineTextEditor()
|
||||
{
|
||||
DefaultStyleKeyProperty.OverrideMetadata( typeof( MultiLineTextEditor ), new FrameworkPropertyMetadata( typeof( MultiLineTextEditor ) ) );
|
||||
}
|
||||
|
||||
public MultiLineTextEditor()
|
||||
{
|
||||
Keyboard.AddKeyDownHandler( this, OnKeyDown );
|
||||
Mouse.AddPreviewMouseDownOutsideCapturedElementHandler( this, OnMouseDownOutsideCapturedElement );
|
||||
}
|
||||
|
||||
#endregion //Constructors
|
||||
|
||||
#region Bass Class Overrides
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
if( _resizeThumb != null )
|
||||
_resizeThumb.DragDelta -= ResizeThumb_DragDelta;
|
||||
|
||||
_resizeThumb = GetTemplateChild( PART_ResizeThumb ) as Thumb;
|
||||
|
||||
if( _resizeThumb != null )
|
||||
_resizeThumb.DragDelta += ResizeThumb_DragDelta;
|
||||
|
||||
_textBox = GetTemplateChild( PART_TextBox ) as TextBox;
|
||||
_toggleButton = GetTemplateChild( PART_DropDownButton ) as ToggleButton;
|
||||
}
|
||||
|
||||
#endregion //Bass Class Overrides
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void OnKeyDown( object sender, KeyEventArgs e )
|
||||
{
|
||||
if( !IsOpen )
|
||||
{
|
||||
if( KeyboardUtilities.IsKeyModifyingPopupState( e ) )
|
||||
{
|
||||
IsOpen = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( KeyboardUtilities.IsKeyModifyingPopupState( e )
|
||||
|| ( e.Key == Key.Escape )
|
||||
|| ( e.Key == Key.Tab ) )
|
||||
{
|
||||
CloseEditor();
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OnMouseDownOutsideCapturedElement( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
CloseEditor();
|
||||
}
|
||||
|
||||
void ResizeThumb_DragDelta( object sender, DragDeltaEventArgs e )
|
||||
{
|
||||
double yadjust = DropDownHeight + e.VerticalChange;
|
||||
double xadjust = DropDownWidth + e.HorizontalChange;
|
||||
|
||||
if( ( xadjust >= 0 ) && ( yadjust >= 0 ) )
|
||||
{
|
||||
DropDownWidth = xadjust;
|
||||
DropDownHeight = yadjust;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion //Event Handlers
|
||||
|
||||
#region Methods
|
||||
|
||||
private void CloseEditor()
|
||||
{
|
||||
if( IsOpen )
|
||||
IsOpen = false;
|
||||
ReleaseMouseCapture();
|
||||
|
||||
_toggleButton.Focus();
|
||||
}
|
||||
|
||||
#endregion //Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
<!--***********************************************************************************
|
||||
|
||||
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:local="clr-namespace:Xceed.Wpf.Toolkit"
|
||||
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
|
||||
xmlns:themes="clr-namespace:Xceed.Wpf.Toolkit.Themes"
|
||||
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Themes/Aero2/Common.xaml" />
|
||||
<ResourceDictionary Source="../../Themes/Aero2/Glyphs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||
|
||||
<Image x:Key="DefaultContent"
|
||||
x:Shared="False"
|
||||
Height="16"
|
||||
Width="18"
|
||||
Source="./../Images/Notes16.png" />
|
||||
|
||||
<Style x:Key="ToggleButtonStyle"
|
||||
TargetType="ToggleButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
SnapsToDevicePixels="True">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Border>
|
||||
|
||||
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
|
||||
Grid.Column="1"
|
||||
CornerRadius="0"
|
||||
RenderChecked="{Binding IsOpen, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MultiLineTextEditor}}"
|
||||
RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MultiLineTextEditor}}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}"
|
||||
RenderPressed="{TemplateBinding IsPressed}">
|
||||
<Grid x:Name="arrowGlyph"
|
||||
IsHitTestVisible="False"
|
||||
Grid.Column="1"
|
||||
Margin="5">
|
||||
<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>
|
||||
|
||||
</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>
|
||||
|
||||
|
||||
<!-- =============================================================================== -->
|
||||
<!-- MultiLineTextEditor -->
|
||||
<!-- =============================================================================== -->
|
||||
|
||||
<Style TargetType="{x:Type local:MultiLineTextEditor}">
|
||||
<Setter Property="Background"
|
||||
Value="White" />
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ControlNormalBorderKey}}" />
|
||||
<Setter Property="BorderThickness"
|
||||
Value="1,1,0,1" />
|
||||
<Setter Property="Content"
|
||||
Value="{StaticResource DefaultContent}" />
|
||||
<Setter Property="IsTabStop"
|
||||
Value="False" />
|
||||
<Setter Property="Padding"
|
||||
Value="2,0,0,0" />
|
||||
<Setter Property="HorizontalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment"
|
||||
Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:MultiLineTextEditor}">
|
||||
<Grid x:Name="Root">
|
||||
<ToggleButton x:Name="PART_DropDownButton"
|
||||
Grid.Column="1"
|
||||
IsTabStop="True"
|
||||
MinHeight="22"
|
||||
SnapsToDevicePixels="True"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource ToggleButtonStyle}"
|
||||
IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
<Popup IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"
|
||||
StaysOpen="False"
|
||||
Placement="Bottom"
|
||||
SnapsToDevicePixels="True"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
PopupAnimation="Slide"
|
||||
Width="{TemplateBinding DropDownWidth}"
|
||||
Height="{TemplateBinding DropDownHeight}"
|
||||
ToolTip="{x:Static sys:String.Empty}">
|
||||
<Popup.Resources>
|
||||
<Style TargetType="ToolTip">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Content"
|
||||
Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Visibility"
|
||||
Value="Collapsed" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Popup.Resources>
|
||||
<Border BorderThickness="1"
|
||||
Background="White"
|
||||
BorderBrush="{StaticResource PopupDarkBorderBrush}">
|
||||
<Grid>
|
||||
<TextBox x:Name="PART_TextBox"
|
||||
AcceptsReturn="true"
|
||||
TextWrapping="{TemplateBinding TextWrapping}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
SpellCheck.IsEnabled="{TemplateBinding IsSpellCheckEnabled}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
Margin="3" />
|
||||
<Thumb x:Name="PART_ResizeThumb"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Cursor="SizeNWSE">
|
||||
<Thumb.Template>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Grid Background="Transparent">
|
||||
<Path Data="M0.5,6.5 L6.5,0.5 M6.5,3.5 L3.5,6.5"
|
||||
Stroke="Black"
|
||||
StrokeThickness="1" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Thumb.Template>
|
||||
</Thumb>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver"
|
||||
Value="True">
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ControlMouseOverBorderKey}}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsKeyboardFocusWithin"
|
||||
Value="True">
|
||||
<Setter Property="BorderBrush"
|
||||
Value="{DynamicResource {x:Static themes:ResourceKeys.ControlSelectedBorderKey}}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
189
Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml
Normal file
189
Src/Xceed.Wpf.Toolkit/MultiLineTextEditor/Themes/Generic.xaml
Normal file
@@ -0,0 +1,189 @@
|
||||
<!--***********************************************************************************
|
||||
|
||||
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:local="clr-namespace:Xceed.Wpf.Toolkit"
|
||||
xmlns:chrome="clr-namespace:Xceed.Wpf.Toolkit.Chromes"
|
||||
xmlns:conv="clr-namespace:Xceed.Wpf.Toolkit.Core.Converters"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib">
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="..\..\Themes\Generic\Glyphs.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
<conv:InverseBoolConverter x:Key="InverseBoolConverter" />
|
||||
|
||||
<Image x:Key="DefaultContent" x:Shared="False" Height="16" Width="18" Source="./../Images/Notes16.png" />
|
||||
|
||||
<LinearGradientBrush x:Key="PopupDarkBorderBrush" 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>
|
||||
|
||||
<Style x:Key="ToggleButtonStyle" TargetType="ToggleButton">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ToggleButton">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
|
||||
<ContentPresenter Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
</Border>
|
||||
|
||||
<chrome:ButtonChrome x:Name="ToggleButtonChrome"
|
||||
Grid.Column="1"
|
||||
CornerRadius="0,2.75,2.75,0"
|
||||
RenderChecked="{Binding IsOpen, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MultiLineTextEditor}}"
|
||||
RenderEnabled="{Binding IsEnabled, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:MultiLineTextEditor}}"
|
||||
RenderMouseOver="{TemplateBinding IsMouseOver}"
|
||||
RenderPressed="{TemplateBinding IsPressed}">
|
||||
<Grid x:Name="arrowGlyph" IsHitTestVisible="False" Grid.Column="1" Margin="5">
|
||||
<Path x:Name="Arrow"
|
||||
Width="9"
|
||||
Height="5"
|
||||
Data="{StaticResource DownArrowGeometry}"
|
||||
Fill="#FF000000"
|
||||
Margin="0,1,0,0"/>
|
||||
</Grid>
|
||||
</chrome:ButtonChrome>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsEnabled" Value="False">
|
||||
<Setter Property="Fill" TargetName="Arrow" Value="#AFAFAF" />
|
||||
<Setter Property="Foreground" Value="Gray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type local:MultiLineTextEditor}">
|
||||
<Setter Property="Background" Value="White"/>
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<LinearGradientBrush 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>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderThickness" Value="1,1,0,1" />
|
||||
<Setter Property="Content" Value="{StaticResource DefaultContent}" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="Padding" Value="2,0,0,0" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Center" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:MultiLineTextEditor}">
|
||||
<Grid x:Name="Root">
|
||||
<ToggleButton x:Name="PART_DropDownButton"
|
||||
Grid.Column="1"
|
||||
IsTabStop="True"
|
||||
MinHeight="22"
|
||||
SnapsToDevicePixels="True"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
|
||||
IsChecked="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Style="{StaticResource ToggleButtonStyle}"
|
||||
IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" />
|
||||
<Popup IsOpen="{Binding IsChecked, ElementName=PART_DropDownButton}"
|
||||
StaysOpen="False"
|
||||
Placement="Bottom"
|
||||
SnapsToDevicePixels="True"
|
||||
AllowsTransparency="True"
|
||||
Focusable="False"
|
||||
PopupAnimation="Slide"
|
||||
Width="{TemplateBinding DropDownWidth}"
|
||||
Height="{TemplateBinding DropDownHeight}"
|
||||
ToolTip="{x:Static sys:String.Empty}">
|
||||
<Popup.Resources>
|
||||
<Style TargetType="ToolTip">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="Content"
|
||||
Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Visibility"
|
||||
Value="Collapsed" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Popup.Resources>
|
||||
<Border BorderThickness="1" Background="{StaticResource PopupBackgroundBrush}" BorderBrush="{StaticResource PopupDarkBorderBrush}">
|
||||
<Grid>
|
||||
<TextBox x:Name="PART_TextBox"
|
||||
AcceptsReturn="true"
|
||||
TextWrapping="{TemplateBinding TextWrapping}"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
SpellCheck.IsEnabled="{TemplateBinding IsSpellCheckEnabled}"
|
||||
IsReadOnly="{TemplateBinding IsReadOnly}"
|
||||
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
TextAlignment="{TemplateBinding TextAlignment}"
|
||||
Margin="3" />
|
||||
<Thumb x:Name="PART_ResizeThumb" HorizontalAlignment="Right" VerticalAlignment="Bottom" Cursor="SizeNWSE">
|
||||
<Thumb.Template>
|
||||
<ControlTemplate TargetType="{x:Type Thumb}">
|
||||
<Grid Background="Transparent">
|
||||
<Path Data="M0.5,6.5 L6.5,0.5 M6.5,3.5 L3.5,6.5" Stroke="Black" StrokeThickness="1" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Thumb.Template>
|
||||
</Thumb>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Popup>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user