IsPortless 画线

This commit is contained in:
艾竹
2023-01-27 20:10:17 +08:00
parent 72e3efb052
commit e8bd6faa21
15 changed files with 197 additions and 49 deletions

View File

@@ -31,6 +31,7 @@
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
AcceptsReturn="True"
IsHitTestVisible="False"
s:ControlAttachProperty.Watermark="{Binding Path=(s:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type s:TextControl}}}"
Style="{StaticResource WaterTextBoxWithEffect}" IsReadOnly="True">

View File

@@ -18,15 +18,15 @@ namespace AIStudio.Wpf.DiagramDesigner
/// </summary>
public partial class TextControl : UserControl
{
public static readonly DependencyProperty DoubleEditProperty = DependencyProperty.Register(
nameof(DoubleEdit), typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(
true));
//public static readonly DependencyProperty DoubleEditProperty = DependencyProperty.Register(
// nameof(DoubleEdit), typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(
// true));
public bool DoubleEdit
{
get => (bool)GetValue(DoubleEditProperty);
set => SetValue(DoubleEditProperty, value);
}
//public bool DoubleEdit
//{
// get => (bool)GetValue(DoubleEditProperty);
// set => SetValue(DoubleEditProperty, value);
//}
public TextControl()
{
@@ -69,13 +69,7 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
}
}
protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
{
base.OnPreviewMouseDown(e);
if (DoubleEdit == false)
else if (e.PropertyName == "EditText")
{
PART_ShowText.Visibility = Visibility.Visible;
PART_TextBlock.Visibility = Visibility.Collapsed;
@@ -87,21 +81,37 @@ namespace AIStudio.Wpf.DiagramDesigner
}
}
protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
{
base.OnPreviewMouseDoubleClick(e);
//protected override void OnPreviewMouseDown(MouseButtonEventArgs e)
//{
// base.OnPreviewMouseDown(e);
if (DoubleEdit == true)
{
PART_ShowText.Visibility = Visibility.Visible;
PART_TextBlock.Visibility = Visibility.Collapsed;
PART_ShowText.Focus();
if (!string.IsNullOrEmpty(PART_ShowText.Text))
{
PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
}
}
}
// if (DoubleEdit == false)
// {
// PART_ShowText.Visibility = Visibility.Visible;
// PART_TextBlock.Visibility = Visibility.Collapsed;
// PART_ShowText.Focus();
// if (!string.IsNullOrEmpty(PART_ShowText.Text))
// {
// PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
// }
// }
//}
//protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
//{
// base.OnPreviewMouseDoubleClick(e);
// if (DoubleEdit == true)
// {
// PART_ShowText.Visibility = Visibility.Visible;
// PART_TextBlock.Visibility = Visibility.Collapsed;
// PART_ShowText.Focus();
// if (!string.IsNullOrEmpty(PART_ShowText.Text))
// {
// PART_ShowText.SelectionStart = PART_ShowText.Text.Length;
// }
// }
//}
}
public class ControlAttachProperty