|
6 | 6 | xmlns:local="clr-namespace:iNKORE.UI.WPF.Modern.Gallery" |
7 | 7 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
8 | 8 | xmlns:sys="clr-namespace:System;assembly=mscorlib" |
9 | | - xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" |
| 9 | + xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" |
10 | 10 | Title="Icon Element" |
11 | 11 | d:DesignWidth="800" |
12 | 12 | Loaded="Page_Loaded" |
|
34 | 34 | Click="MonochromeButton_Click"/> |
35 | 35 | </local:ControlExample.Options> |
36 | 36 | </local:ControlExample> |
37 | | - <local:ControlExample |
38 | | - x:Name="Example2" |
| 37 | + <local:ControlExample x:Name="Example2" |
| 38 | + HeaderText="A FontIcon using pre-defined icon sets"> |
| 39 | + <local:ControlExample.Example> |
| 40 | + <StackPanel> |
| 41 | + <TextBlock Margin="0,0,0,12" Style="{DynamicResource BodyTextBlockStyle}" |
| 42 | + Text="There are a bunch of pre-defined icon sets that you can use in your application. The Segoe Fluent Icons is one of them and it is used in this example. You can use the Icon property to set the icon for a control, which is the most recommended and preferred way to use icons in your application. This saves you from having to look up the glyph value and font family to use." /> |
| 43 | + |
| 44 | + <ikw:SimpleStackPanel Spacing="4" Orientation="Vertical" HorizontalAlignment="Left"> |
| 45 | + <FrameworkElement.Resources> |
| 46 | + <Style TargetType="ikw:SimpleStackPanel"> |
| 47 | + <Setter Property="Spacing" Value="8"/> |
| 48 | + <Setter Property="Orientation" Value="Horizontal"/> |
| 49 | + </Style> |
| 50 | + <Style TargetType="Button" BasedOn="{StaticResource {x:Static ui:ThemeKeys.DefaultButtonStyleKey}}"> |
| 51 | + <Setter Property="HorizontalAlignment" Value="Stretch"/> |
| 52 | + <Setter Property="HorizontalContentAlignment" Value="Left"/> |
| 53 | + </Style> |
| 54 | + </FrameworkElement.Resources> |
| 55 | + |
| 56 | + <!--Segoe Fluent Icons--> |
| 57 | + <TextBlock Margin="0,0,0,10" FontSize="16" FontWeight="SemiBold"> |
| 58 | + Segoe Fluent Icons |
| 59 | + </TextBlock> |
| 60 | + |
| 61 | + <Button> |
| 62 | + <ikw:SimpleStackPanel> |
| 63 | + <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Settings}" /> |
| 64 | + <TextBlock> |
| 65 | + SegoeFluentIcons | Settings |
| 66 | + </TextBlock> |
| 67 | + </ikw:SimpleStackPanel> |
| 68 | + </Button> |
| 69 | + <Button> |
| 70 | + <ikw:SimpleStackPanel> |
| 71 | + <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Document}" /> |
| 72 | + <TextBlock> |
| 73 | + SegoeFluentIcons | Document |
| 74 | + </TextBlock> |
| 75 | + </ikw:SimpleStackPanel> |
| 76 | + </Button> |
| 77 | + <Button> |
| 78 | + <ikw:SimpleStackPanel> |
| 79 | + <ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.SendFill}" /> |
| 80 | + <TextBlock> |
| 81 | + SegoeFluentIcons | SendFill |
| 82 | + </TextBlock> |
| 83 | + </ikw:SimpleStackPanel> |
| 84 | + </Button> |
| 85 | + |
| 86 | + <!--Fluent System Icons--> |
| 87 | + <TextBlock Margin="0,10" FontSize="16" FontWeight="SemiBold"> |
| 88 | + Fluent System Icons |
| 89 | + </TextBlock> |
| 90 | + |
| 91 | + <Button> |
| 92 | + <ikw:SimpleStackPanel> |
| 93 | + <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Home_16_Regular}" /> |
| 94 | + <TextBlock> |
| 95 | + FluentSystemIcons | Home_16_Regular |
| 96 | + </TextBlock> |
| 97 | + </ikw:SimpleStackPanel> |
| 98 | + </Button> |
| 99 | + <Button> |
| 100 | + <ikw:SimpleStackPanel> |
| 101 | + <ui:FontIcon Icon="{x:Static ui:FluentSystemIcons.Accessibility_16_Regular}" /> |
| 102 | + <TextBlock> |
| 103 | + FluentSystemIcons | Accessibility_16_Regular |
| 104 | + </TextBlock> |
| 105 | + </ikw:SimpleStackPanel> |
| 106 | + </Button> |
| 107 | + </ikw:SimpleStackPanel> |
| 108 | + |
| 109 | + <TextBlock Margin="0,16,0,0" Style="{DynamicResource BodyTextBlockStyle}" |
| 110 | + Text="You can also define your own icon sets by creating a static class with static properties that return the icon you want to use. This is what the SegoeFluentIcons and FluentSystemIcons classes are doing." /> |
| 111 | + |
| 112 | + </StackPanel> |
| 113 | + </local:ControlExample.Example> |
| 114 | + </local:ControlExample> |
| 115 | + <local:ControlExample x:Name="Example3" |
| 116 | + HeaderText="Group icon and text even faster"> |
| 117 | + <local:ControlExample.Example> |
| 118 | + <StackPanel> |
| 119 | + <TextBlock Margin="0,0,0,12" Style="{DynamicResource BodyTextBlockStyle}" |
| 120 | + Text="When using icon and text together, you can use the IconAndText control to write your XAML much more concisely. The IconAndText control is a simple control that combines an icon and text together in a single control. It is used in the examples below to show how you can use it to create buttons with icons and text." /> |
| 121 | + <Button Margin="0,0,0,8"> |
| 122 | + <ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Audio}" Content="Pick a music"/> |
| 123 | + </Button> |
| 124 | + <Button Padding="12,12,12,8"> |
| 125 | + <ui:IconAndText Icon="{x:Static ui:SegoeFluentIcons.Send}" |
| 126 | + Content="Send" IconSize="24" Orientation="Vertical" Spacing="8"/> |
| 127 | + </Button> |
| 128 | + |
| 129 | + </StackPanel> |
| 130 | + </local:ControlExample.Example> |
| 131 | + </local:ControlExample> |
| 132 | + |
| 133 | + <local:ControlExample x:Name="Example4" |
39 | 134 | HeaderText="A FontIcon using a glyph from a specific font family in a button"> |
40 | 135 | <local:ControlExample.Example> |
41 | 136 | <StackPanel> |
42 | 137 | <TextBlock |
43 | 138 | Margin="0,0,0,12" |
44 | 139 | Style="{DynamicResource BodyTextBlockStyle}" |
45 | 140 | Text="Use FontIcon as the icon for a control if you want to specify a Glyph value from a FontFamily. Windows 10 uses the Segoe MDL2 Assets FontFamily and that is what this example is showing." /> |
46 | | - <Button Name="ExampleButton1"> |
| 141 | + <Button> |
47 | 142 | <ui:FontIcon FontFamily="Segoe MDL2 Assets" Glyph="" /> |
48 | 143 | </Button> |
49 | 144 | </StackPanel> |
50 | 145 | </local:ControlExample.Example> |
51 | 146 | </local:ControlExample> |
52 | | - <local:ControlExample |
53 | | - x:Name="Example3" |
| 147 | + <local:ControlExample x:Name="Example5" |
54 | 148 | HeaderText="A ImageIcon using a bitmap image in a button"> |
55 | 149 | <local:ControlExample.Example> |
56 | 150 | <StackPanel> |
|
65 | 159 | </local:ControlExample.Example> |
66 | 160 | </local:ControlExample> |
67 | 161 | <!--<local:ControlExample |
68 | | - x:Name="Example4" |
| 162 | + x:Name="Example6" |
69 | 163 | HeaderText="A ImageIcon using a SVG image in a button"> |
70 | 164 | <local:ControlExample.Example> |
71 | 165 | <Button Name="ImageExample2"> |
72 | 166 | <ui:ImageIcon Width="50" Source="https://raw.githubusercontent.com/DiemenDesign/LibreICONS/master/svg-color/libre-camera-panorama.svg" /> |
73 | 167 | </Button> |
74 | 168 | </local:ControlExample.Example> |
75 | 169 | </local:ControlExample>--> |
76 | | - <local:ControlExample |
77 | | - x:Name="Example5" |
| 170 | + <local:ControlExample x:Name="Example7" |
78 | 171 | HeaderText="A PathIcon in a button"> |
79 | 172 | <local:ControlExample.Example> |
80 | 173 | <StackPanel> |
|
88 | 181 | </StackPanel> |
89 | 182 | </local:ControlExample.Example> |
90 | 183 | </local:ControlExample> |
91 | | - <local:ControlExample |
92 | | - x:Name="Example6" |
93 | | - HeaderText="A SymbolIcon in a button"> |
94 | | - <local:ControlExample.Example> |
95 | | - <StackPanel> |
96 | | - <TextBlock |
97 | | - Margin="0,0,0,12" |
98 | | - Style="{DynamicResource BodyTextBlockStyle}" |
99 | | - Text="To use a SymbolIcon as the icon for a control, you specify the enum value for the glyph you would like to display. SymbolIcon's enum is based off of icons from the Segoe MDL2 font used by Windows 10." /> |
100 | | - <Button Name="AcceptButton"> |
101 | | - <ui:IconAndText Content="Confirm" |
102 | | - Icon="{x:Static ui:SegoeFluentIcons.Accept}"/> |
103 | | - </Button> |
104 | | - </StackPanel> |
105 | | - </local:ControlExample.Example> |
106 | | - </local:ControlExample> |
107 | 184 | </StackPanel> |
108 | 185 | </ui:Page> |
0 commit comments