mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-09 02:36:35 +08:00
demo提交
This commit is contained in:
@@ -7,59 +7,15 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:TrueToFalseConverter x:Key="TrueToFalseConverter"/>
|
||||
<!--TextBox默认样式-->
|
||||
<Style TargetType="{x:Type TextBox}" x:Key="WaterTextBox">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="TextWrapping" Value="Wrap"/>
|
||||
<Setter Property="Width" Value="Auto"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type TextBox}">
|
||||
<Grid x:Name="PART_Root">
|
||||
<Border x:Name="Bg" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
Background="{TemplateBinding Background}" />
|
||||
<Grid x:Name="PART_InnerGrid">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!--内容区域-->
|
||||
<ScrollViewer x:Name="PART_ContentHost" BorderThickness="0" Grid.Column="1" IsTabStop="False" Margin="2"
|
||||
VerticalAlignment="Stretch" Background="{x:Null}" >
|
||||
<ScrollViewer.Effect>
|
||||
<DropShadowEffect x:Name="effect" Color="{Binding FontViewModel.TextEffectColor}" ></DropShadowEffect>
|
||||
</ScrollViewer.Effect>
|
||||
</ScrollViewer>
|
||||
<!--水印-->
|
||||
<TextBlock x:Name="Message" Padding="{TemplateBinding Padding}" Visibility="Collapsed"
|
||||
Text="{TemplateBinding s:ControlAttachProperty.Watermark}" Grid.Column="1"
|
||||
Foreground="{TemplateBinding Foreground}" IsHitTestVisible="False" Opacity="0.5"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="5,2,5,2" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<!--显示水印-->
|
||||
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=Text}" Value="">
|
||||
<Setter TargetName="Message" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding FontViewModel.TextEffectColor}" Value="Transparent">
|
||||
<Setter TargetName="PART_ContentHost" Property="Effect" Value="{x:Null}"/>
|
||||
</DataTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/AIStudio.Wpf.DiagramDesigner;component/Styles/TextBox.xaml" />
|
||||
<ResourceDictionary>
|
||||
<s:ColorBrushConverter x:Key="ColorBrushConverter" />
|
||||
<s:TrueToFalseConverter x:Key="TrueToFalseConverter"/>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid IsHitTestVisible="{Binding IsHitTestVisible}">
|
||||
<TextBox x:Name="PART_TextBlock"
|
||||
@@ -76,7 +32,7 @@
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
s:ControlAttachProperty.Watermark="{Binding Path=(s:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type s:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBox}" IsReadOnly="True">
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" IsReadOnly="True">
|
||||
|
||||
</TextBox>
|
||||
<TextBox x:Name="PART_ShowText"
|
||||
@@ -94,7 +50,7 @@
|
||||
TextBlock.LineHeight="{Binding FontViewModel.LineHeight}"
|
||||
AcceptsReturn="True"
|
||||
s:ControlAttachProperty.Watermark="{Binding Path=(s:ControlAttachProperty.Watermark),RelativeSource={RelativeSource AncestorType={x:Type s:TextControl}}}"
|
||||
Style="{StaticResource WaterTextBox}" Visibility="Collapsed">
|
||||
Style="{StaticResource WaterTextBoxWithEffect}" Visibility="Collapsed">
|
||||
</TextBox>
|
||||
|
||||
</Grid>
|
||||
|
||||
Reference in New Issue
Block a user