mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-13 20:56:35 +08:00
思维导图修改成回车新增子节点
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
HorizontalContentAlignment="{Binding FontViewModel.HorizontalAlignment}"
|
||||
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
AcceptsReturn="{Binding AcceptsReturn,RelativeSource={RelativeSource AncestorType=dd:TextControl}}"
|
||||
IsHitTestVisible="False"
|
||||
dd:ControlAttachProperty.Watermark="{Binding Path=(dd:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type dd:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" IsReadOnly="True">
|
||||
@@ -49,7 +49,7 @@
|
||||
HorizontalContentAlignment="{Binding FontViewModel.HorizontalAlignment}"
|
||||
VerticalContentAlignment="{Binding FontViewModel.VerticalAlignment}"
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
AcceptsReturn="{Binding AcceptsReturn,RelativeSource={RelativeSource AncestorType=dd:TextControl}}"
|
||||
Focusable="False"
|
||||
dd:ControlAttachProperty.Watermark="{Binding Path=(dd:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type dd:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" Visibility="Collapsed">
|
||||
|
||||
@@ -18,6 +18,16 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
/// </summary>
|
||||
public partial class TextControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty AcceptsReturnProperty = DependencyProperty.Register(
|
||||
nameof(AcceptsReturn), typeof(bool), typeof(TextControl), new FrameworkPropertyMetadata(
|
||||
true));
|
||||
|
||||
public bool AcceptsReturn
|
||||
{
|
||||
get => (bool)GetValue(AcceptsReturnProperty);
|
||||
set => SetValue(AcceptsReturnProperty, value);
|
||||
}
|
||||
|
||||
public TextControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -78,9 +88,11 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
BindingExpression binding = PART_ShowText.GetBindingExpression(TextBox.TextProperty);
|
||||
binding.UpdateSource();
|
||||
|
||||
PART_ShowText.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));
|
||||
PART_ShowText.Visibility = Visibility.Collapsed;
|
||||
PART_TextBlock.Visibility = Visibility.Visible;
|
||||
|
||||
PART_TextBlock.Visibility = Visibility.Visible;
|
||||
|
||||
|
||||
selectable.IsEditing = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user