|
1 |
| -<Application x:Class="MyScript.IInk.Demo.App" |
2 |
| - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 |
| - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 |
| - xmlns:local="clr-namespace:MyScript.IInk.Demo" |
5 |
| - xmlns:Font="http://schemas.fontawesome.io/icons/" |
6 |
| - StartupUri="MainWindow.xaml"> |
7 |
| - <Application.Resources> |
8 |
| - |
9 |
| - <Style x:Key="Icon" TargetType="Font:ImageAwesome"> |
10 |
| - <Setter Property="Foreground" Value="Black"></Setter> |
11 |
| - <Style.Triggers> |
12 |
| - <Trigger Property="IsMouseOver" Value="True"> |
13 |
| - <Setter Property="Foreground" Value="Gray"/> |
14 |
| - </Trigger> |
15 |
| - </Style.Triggers> |
16 |
| - </Style> |
17 |
| - |
18 |
| - <SolidColorBrush x:Key="WindowBackgroundBrush" Color="WhiteSmoke" /> |
19 |
| - |
20 |
| - <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton"> |
21 |
| - <Border > |
22 |
| - <Grid> |
23 |
| - <Grid.ColumnDefinitions> |
24 |
| - <ColumnDefinition Width="*" /> |
25 |
| - <ColumnDefinition Width="auto" /> |
26 |
| - </Grid.ColumnDefinitions> |
27 |
| - <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" |
28 |
| - Background="Transparent" |
29 |
| - BorderThickness="1" /> |
30 |
| - <Border |
31 |
| - Grid.Column="0" |
32 |
| - CornerRadius="2,0,0,2" |
33 |
| - Background="Transparent" |
34 |
| - BorderThickness="0,0,1,0" /> |
35 |
| - <Font:ImageAwesome Width="10" Icon="CaretDown" Foreground="Black" ></Font:ImageAwesome> |
36 |
| - </Grid> |
37 |
| - </Border> |
38 |
| - </ControlTemplate> |
39 |
| - |
40 |
| - <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox"> |
41 |
| - <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" /> |
42 |
| - </ControlTemplate> |
43 |
| - |
44 |
| - <Style x:Key="{x:Type ComboBox}" TargetType="ComboBox"> |
45 |
| - <Setter Property="Template"> |
46 |
| - <Setter.Value> |
47 |
| - <ControlTemplate TargetType="ComboBox"> |
48 |
| - <Grid> |
49 |
| - <ToggleButton |
50 |
| - Name="ToggleButton" |
51 |
| - Template="{StaticResource ComboBoxToggleButton}" |
52 |
| - Grid.Column="2" |
53 |
| - Focusable="false" |
54 |
| - IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" |
55 |
| - ClickMode="Press"> |
56 |
| - </ToggleButton> |
57 |
| - <ContentPresenter |
58 |
| - Name="ContentSite" |
59 |
| - IsHitTestVisible="False" |
60 |
| - Margin="3,3,50,3" |
61 |
| - VerticalAlignment="Center" |
62 |
| - HorizontalAlignment="Left" /> |
63 |
| - <TextBox x:Name="PART_EditableTextBox" |
64 |
| - Style="{x:Null}" |
65 |
| - Template="{StaticResource ComboBoxTextBox}" |
66 |
| - HorizontalAlignment="Left" |
67 |
| - VerticalAlignment="Center" |
68 |
| - Margin="3,3,23,3" |
69 |
| - Focusable="True" |
70 |
| - Background="Transparent" |
71 |
| - Visibility="Hidden" |
72 |
| - IsReadOnly="{TemplateBinding IsReadOnly}"/> |
73 |
| - <Popup |
74 |
| - Name="Popup" |
75 |
| - Placement="Bottom" |
76 |
| - IsOpen="{TemplateBinding IsDropDownOpen}" |
77 |
| - AllowsTransparency="True" |
78 |
| - Focusable="False" |
79 |
| - PopupAnimation="Slide"> |
80 |
| - <Grid |
81 |
| - Name="DropDown" |
82 |
| - SnapsToDevicePixels="True" |
83 |
| - MinWidth="{TemplateBinding ActualWidth}" |
84 |
| - MaxHeight="{TemplateBinding MaxDropDownHeight}"> |
85 |
| - <Border |
86 |
| - x:Name="DropDownBorder" |
87 |
| - Background="{StaticResource WindowBackgroundBrush}" |
88 |
| - BorderThickness="1"/> |
89 |
| - <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True"> |
90 |
| - <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" /> |
91 |
| - </ScrollViewer> |
92 |
| - </Grid> |
93 |
| - </Popup> |
94 |
| - </Grid> |
95 |
| - </ControlTemplate> |
96 |
| - </Setter.Value> |
97 |
| - </Setter> |
98 |
| - <Style.Triggers> |
99 |
| - </Style.Triggers> |
100 |
| - </Style> |
101 |
| - |
102 |
| - <Style |
103 |
| - x:Key="ButtonFocusVisual"> |
104 |
| - <Setter |
105 |
| - Property="Control.Template"> |
106 |
| - <Setter.Value> |
107 |
| - <ControlTemplate> |
108 |
| - <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" /> |
109 |
| - </ControlTemplate> |
110 |
| - </Setter.Value> |
111 |
| - </Setter> |
112 |
| - </Style> |
113 |
| - |
114 |
| - <Style x:Key="CustomButton" TargetType="{x:Type Button}"> |
115 |
| - <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/> |
116 |
| - <Setter Property="Margin" Value="20"></Setter> |
117 |
| - <Setter Property="Background" Value="Transparent"/> |
118 |
| - <Setter Property="Foreground" Value="Black"/> |
119 |
| - <Setter Property="HorizontalContentAlignment" Value="Center"/> |
120 |
| - <Setter Property="VerticalContentAlignment" Value="Center"/> |
121 |
| - <Setter Property="Padding" Value="10 5"/> |
122 |
| - <Setter Property="FontSize" Value="14" /> |
123 |
| - <Setter Property="BorderThickness" Value="0" /> |
124 |
| - <Setter Property="Template"> |
125 |
| - <Setter.Value> |
126 |
| - <ControlTemplate TargetType="{x:Type Button}"> |
127 |
| - <Grid > |
128 |
| - <Border |
129 |
| - x:Name="Border" |
130 |
| - Background="{TemplateBinding Background}" |
131 |
| - BorderBrush="{TemplateBinding BorderBrush}" |
132 |
| - BorderThickness="{TemplateBinding BorderThickness}" /> |
133 |
| - |
134 |
| - <ContentPresenter |
135 |
| - HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
136 |
| - Margin="{TemplateBinding Padding}" |
137 |
| - VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
138 |
| - RecognizesAccessKey="True" /> |
139 |
| - </Grid> |
140 |
| - <ControlTemplate.Triggers> |
141 |
| - <Trigger Property="IsPressed" Value="True"> |
142 |
| - <Setter Property="OpacityMask" Value="#AA888888"/> |
143 |
| - </Trigger> |
144 |
| - <Trigger Property="IsMouseOver" Value="True"> |
145 |
| - <Setter Property="Background" Value="LightGray"/> |
146 |
| - </Trigger> |
147 |
| - <Trigger Property="IsEnabled" Value="false"> |
148 |
| - <Setter Property="Foreground" Value="#ADADAD"/> |
149 |
| - </Trigger> |
150 |
| - </ControlTemplate.Triggers> |
151 |
| - </ControlTemplate> |
152 |
| - </Setter.Value> |
153 |
| - </Setter> |
154 |
| - </Style> |
155 |
| - </Application.Resources> |
156 |
| -</Application> |
| 1 | +<Application x:Class="MyScript.IInk.Demo.App" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:local="clr-namespace:MyScript.IInk.Demo" |
| 5 | + xmlns:Font="http://schemas.fontawesome.io/icons/" |
| 6 | + StartupUri="MainWindow.xaml"> |
| 7 | + <Application.Resources> |
| 8 | + |
| 9 | + <Style x:Key="Icon" TargetType="Font:ImageAwesome"> |
| 10 | + <Setter Property="Foreground" Value="Black"></Setter> |
| 11 | + <Style.Triggers> |
| 12 | + <Trigger Property="IsMouseOver" Value="True"> |
| 13 | + <Setter Property="Foreground" Value="Gray"/> |
| 14 | + </Trigger> |
| 15 | + </Style.Triggers> |
| 16 | + </Style> |
| 17 | + |
| 18 | + <SolidColorBrush x:Key="WindowBackgroundBrush" Color="WhiteSmoke" /> |
| 19 | + |
| 20 | + <ControlTemplate x:Key="ComboBoxToggleButton" TargetType="ToggleButton"> |
| 21 | + <Border > |
| 22 | + <Grid> |
| 23 | + <Grid.ColumnDefinitions> |
| 24 | + <ColumnDefinition Width="*" /> |
| 25 | + <ColumnDefinition Width="auto" /> |
| 26 | + </Grid.ColumnDefinitions> |
| 27 | + <Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="2" |
| 28 | + Background="Transparent" |
| 29 | + BorderThickness="1" /> |
| 30 | + <Border |
| 31 | + Grid.Column="0" |
| 32 | + CornerRadius="2,0,0,2" |
| 33 | + Background="Transparent" |
| 34 | + BorderThickness="0,0,1,0" /> |
| 35 | + <Font:ImageAwesome Width="10" Icon="CaretDown" Foreground="Black" ></Font:ImageAwesome> |
| 36 | + </Grid> |
| 37 | + </Border> |
| 38 | + </ControlTemplate> |
| 39 | + |
| 40 | + <ControlTemplate x:Key="ComboBoxTextBox" TargetType="TextBox"> |
| 41 | + <Border x:Name="PART_ContentHost" Focusable="False" Background="{TemplateBinding Background}" /> |
| 42 | + </ControlTemplate> |
| 43 | + |
| 44 | + <Style x:Key="{x:Type ComboBox}" TargetType="ComboBox"> |
| 45 | + <Setter Property="Template"> |
| 46 | + <Setter.Value> |
| 47 | + <ControlTemplate TargetType="ComboBox"> |
| 48 | + <Grid> |
| 49 | + <ToggleButton |
| 50 | + Name="ToggleButton" |
| 51 | + Template="{StaticResource ComboBoxToggleButton}" |
| 52 | + Grid.Column="2" |
| 53 | + Focusable="false" |
| 54 | + IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" |
| 55 | + ClickMode="Press"> |
| 56 | + </ToggleButton> |
| 57 | + <ContentPresenter |
| 58 | + Name="ContentSite" |
| 59 | + IsHitTestVisible="False" |
| 60 | + Margin="3,3,50,3" |
| 61 | + VerticalAlignment="Center" |
| 62 | + HorizontalAlignment="Left" /> |
| 63 | + <TextBox x:Name="PART_EditableTextBox" |
| 64 | + Style="{x:Null}" |
| 65 | + Template="{StaticResource ComboBoxTextBox}" |
| 66 | + HorizontalAlignment="Left" |
| 67 | + VerticalAlignment="Center" |
| 68 | + Margin="3,3,23,3" |
| 69 | + Focusable="True" |
| 70 | + Background="Transparent" |
| 71 | + Visibility="Hidden" |
| 72 | + IsReadOnly="{TemplateBinding IsReadOnly}"/> |
| 73 | + <Popup |
| 74 | + Name="Popup" |
| 75 | + Placement="Bottom" |
| 76 | + IsOpen="{TemplateBinding IsDropDownOpen}" |
| 77 | + AllowsTransparency="True" |
| 78 | + Focusable="False" |
| 79 | + PopupAnimation="Slide"> |
| 80 | + <Grid |
| 81 | + Name="DropDown" |
| 82 | + SnapsToDevicePixels="True" |
| 83 | + MinWidth="{TemplateBinding ActualWidth}" |
| 84 | + MaxHeight="{TemplateBinding MaxDropDownHeight}"> |
| 85 | + <Border |
| 86 | + x:Name="DropDownBorder" |
| 87 | + Background="{StaticResource WindowBackgroundBrush}" |
| 88 | + BorderThickness="1"/> |
| 89 | + <ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True"> |
| 90 | + <StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" /> |
| 91 | + </ScrollViewer> |
| 92 | + </Grid> |
| 93 | + </Popup> |
| 94 | + </Grid> |
| 95 | + </ControlTemplate> |
| 96 | + </Setter.Value> |
| 97 | + </Setter> |
| 98 | + <Style.Triggers> |
| 99 | + </Style.Triggers> |
| 100 | + </Style> |
| 101 | + |
| 102 | + <Style |
| 103 | + x:Key="ButtonFocusVisual"> |
| 104 | + <Setter |
| 105 | + Property="Control.Template"> |
| 106 | + <Setter.Value> |
| 107 | + <ControlTemplate> |
| 108 | + <Rectangle Margin="2" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2" /> |
| 109 | + </ControlTemplate> |
| 110 | + </Setter.Value> |
| 111 | + </Setter> |
| 112 | + </Style> |
| 113 | + |
| 114 | + <Style x:Key="CustomButton" TargetType="{x:Type Button}"> |
| 115 | + <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/> |
| 116 | + <Setter Property="Margin" Value="20"></Setter> |
| 117 | + <Setter Property="Background" Value="Transparent"/> |
| 118 | + <Setter Property="Foreground" Value="Black"/> |
| 119 | + <Setter Property="HorizontalContentAlignment" Value="Center"/> |
| 120 | + <Setter Property="VerticalContentAlignment" Value="Center"/> |
| 121 | + <Setter Property="Padding" Value="10 5"/> |
| 122 | + <Setter Property="FontSize" Value="14" /> |
| 123 | + <Setter Property="BorderThickness" Value="0" /> |
| 124 | + <Setter Property="Template"> |
| 125 | + <Setter.Value> |
| 126 | + <ControlTemplate TargetType="{x:Type Button}"> |
| 127 | + <Grid > |
| 128 | + <Border |
| 129 | + x:Name="Border" |
| 130 | + Background="{TemplateBinding Background}" |
| 131 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 132 | + BorderThickness="{TemplateBinding BorderThickness}" /> |
| 133 | + |
| 134 | + <ContentPresenter |
| 135 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 136 | + Margin="{TemplateBinding Padding}" |
| 137 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 138 | + RecognizesAccessKey="True" /> |
| 139 | + </Grid> |
| 140 | + <ControlTemplate.Triggers> |
| 141 | + <Trigger Property="IsPressed" Value="True"> |
| 142 | + <Setter Property="OpacityMask" Value="#AA888888"/> |
| 143 | + </Trigger> |
| 144 | + <Trigger Property="IsMouseOver" Value="True"> |
| 145 | + <Setter Property="Background" Value="LightGray"/> |
| 146 | + </Trigger> |
| 147 | + <Trigger Property="IsEnabled" Value="false"> |
| 148 | + <Setter Property="Foreground" Value="#ADADAD"/> |
| 149 | + </Trigger> |
| 150 | + </ControlTemplate.Triggers> |
| 151 | + </ControlTemplate> |
| 152 | + </Setter.Value> |
| 153 | + </Setter> |
| 154 | + </Style> |
| 155 | + </Application.Resources> |
| 156 | +</Application> |
0 commit comments