添加项目文件。
This commit is contained in:
35
MetroGauges/Controls/TreeNodeEdit.xaml
Normal file
35
MetroGauges/Controls/TreeNodeEdit.xaml
Normal file
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="MetroGauges.TreeNodeEdit"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:MetroGauges"
|
||||
x:Name="mainControl">
|
||||
<UserControl.Resources>
|
||||
|
||||
<local:TextVisibleConvert x:Key="textVisibleConvert"/>
|
||||
|
||||
<DataTemplate x:Key="EditModeTemplate">
|
||||
<TextBox KeyDown="TextBox_KeyDown" Loaded="TextBox_Loaded" LostFocus="TextBox_LostFocus"
|
||||
Text="{Binding ElementName=mainControl, Path=Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Margin="0" BorderThickness="1" Width="130" Background="White" Foreground="Black" />
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate x:Key="DisplayModeTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Image x:Name="itemImage" Width="16" Height="16" Visibility="Collapsed" Source="{Binding ElementName=mainControl,Path=ImageSource, Mode=TwoWay}" ></Image>
|
||||
<TextBlock x:Name="txtText" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding ElementName=mainControl, Path=Text, Mode=TwoWay}" Margin="2" />
|
||||
<TextBlock x:Name="txtRemark" Foreground="Black" VerticalAlignment="Center" HorizontalAlignment="Left" Text="{Binding ElementName=mainControl, Path=Desctrition, Mode=TwoWay}" Margin="2" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
|
||||
<Style TargetType="{x:Type local:TreeNodeEdit}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsInEditMode" Value="True">
|
||||
<Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsInEditMode" Value="False">
|
||||
<Setter Property="ContentTemplate" Value="{StaticResource DisplayModeTemplate}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user