-
Notifications
You must be signed in to change notification settings - Fork 9
/
CBETagControl.xaml
75 lines (72 loc) · 3.84 KB
/
CBETagControl.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<UserControl x:Class="CodeBlockEndTag.CBETagControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:imaging="clr-namespace:Microsoft.VisualStudio.Imaging;assembly=Microsoft.VisualStudio.Imaging"
xmlns:local="clr-namespace:CodeBlockEndTag"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:v="clr-namespace:CodeBlockEndTag.Shell"
d:DesignHeight="20"
d:DesignWidth="100"
Focusable="False"
KeyboardNavigation.IsTabStop="False"
mc:Ignorable="d">
<UserControl.Resources>
<local:AdditionValueConverter x:Key="addConv" />
<local:TextColorConverter x:Key="convColor" />
</UserControl.Resources>
<Button x:Name="btnTag"
Click="Button_Click"
Cursor="Arrow"
Focusable="False"
KeyboardNavigation.IsTabStop="False"
MouseDoubleClick="Button_DoubleClick">
<Button.Template>
<ControlTemplate>
<Canvas Height="{Binding LineHeight}">
<imaging:CrispImage x:Name="imgTag"
Canvas.Left="4"
Canvas.Top="0"
Width="{Binding LineHeight}"
Height="{Binding LineHeight}"
Moniker="{Binding IconMoniker}">
<imaging:CrispImage.Style>
<Style TargetType="imaging:CrispImage">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding DisplayMode}" Value="1">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</imaging:CrispImage.Style>
</imaging:CrispImage>
<TextBlock x:Name="txtTag"
Canvas.Left="{Binding LineHeight, Converter={StaticResource addConv}, ConverterParameter=8}"
Canvas.Top="0"
Background="Transparent"
Focusable="False"
FontFamily="{DynamicResource {x:Static v:EndTagColors.FontFamilyKey}}"
FontSize="{Binding LineHeight}"
FontStyle="Normal"
FontWeight="Normal"
Initialized="TxtTag_OnInitialized"
Foreground="{Binding TextColor, Converter={StaticResource convColor}}"
KeyboardNavigation.IsTabStop="False"
Text="{Binding Text}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Visibility" Value="Visible" />
<Style.Triggers>
<DataTrigger Binding="{Binding DisplayMode}" Value="2">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Canvas>
</ControlTemplate>
</Button.Template>
</Button>
</UserControl>