mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-20 00:16:36 +08:00
IsPortless 画线
This commit is contained in:
@@ -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">
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user