diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs index d0d6f0c1..484a7720 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Implementation/MultiLineTextEditor.cs @@ -10,13 +10,26 @@ namespace Microsoft.Windows.Controls { #region Members - TextBox _textBox; Thumb _resizeThumb; #endregion //Members #region Properties + 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); } + } + + 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); } + } + #region IsOpen public static readonly DependencyProperty IsOpenProperty = DependencyProperty.Register("IsOpen", typeof(bool), typeof(MultiLineTextEditor), new UIPropertyMetadata(false, OnIsOpenChanged)); @@ -40,6 +53,14 @@ namespace Microsoft.Windows.Controls #endregion //IsOpen + 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); } + } + + #region Text public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(MultiLineTextEditor), new FrameworkPropertyMetadata(String.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnTextChanged)); @@ -63,6 +84,21 @@ namespace Microsoft.Windows.Controls #endregion //Text + 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); } + } + + 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 //Properties #region Constructors @@ -86,8 +122,6 @@ namespace Microsoft.Windows.Controls { base.OnApplyTemplate(); - _textBox = (TextBox)GetTemplateChild("PART_TextBox"); - if (_resizeThumb != null) _resizeThumb.DragDelta -= ResizeThumb_DragDelta; _resizeThumb = (Thumb)GetTemplateChild("PART_ResizeThumb"); @@ -97,18 +131,6 @@ namespace Microsoft.Windows.Controls } - void ResizeThumb_DragDelta(object sender, DragDeltaEventArgs e) - { - double yadjust = this._textBox.Height + e.VerticalChange; - double xadjust = this._textBox.Width + e.HorizontalChange; - - if ((xadjust >= 0) && (yadjust >= 0)) - { - this._textBox.Width = xadjust; - this._textBox.Height = yadjust; - } - } - #endregion //Bass Class Overrides #region Event Handlers @@ -131,6 +153,18 @@ namespace Microsoft.Windows.Controls 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 diff --git a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Themes/Generic.xaml b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Themes/Generic.xaml index 1b24ef6e..3a1d6c63 100644 --- a/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Themes/Generic.xaml +++ b/ExtendedWPFToolkitSolution/Src/WPFToolkit.Extended/MultiLineTextEditor/Themes/Generic.xaml @@ -96,14 +96,15 @@ IsHitTestVisible="{Binding IsOpen, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource InverseBoolConverter}}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"/> + Placement="Bottom" SnapsToDevicePixels="True" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide" + Width="{TemplateBinding DropDownWidth}" Height="{TemplateBinding DropDownHeight}"> - - + TextAlignment="{TemplateBinding TextAlignment}" + Margin="3" />