|
10 | 10 | xmlns:behaviors="clr-namespace:OnnxStack.UI.Behaviors" |
11 | 11 | xmlns:models="clr-namespace:OnnxStack.UI.Models" |
12 | 12 | mc:Ignorable="d" |
13 | | - d:DesignWidth="500" Name="UI" Focusable="True" PreviewKeyDown="OnPreviewKeyDown" MouseEnter="OnMouseEnter" AllowDrop="True" PreviewDrop="OnPreviewDrop"> |
| 13 | + d:DesignWidth="500" Name="UI" Focusable="True" PreviewKeyDown="OnPreviewKeyDown" MouseEnter="OnMouseEnter" AllowDrop="True" PreviewDrop="OnPreviewDrop" PreviewMouseWheel="OnMouseWheel"> |
14 | 14 | <UserControl.Resources> |
15 | 15 | <Style TargetType="{x:Type Label}"> |
16 | 16 | <Setter Property="Margin" Value="-4,0,0,-4"/> |
17 | 17 | </Style> |
18 | 18 | </UserControl.Resources> |
19 | 19 |
|
20 | 20 | <Border DataContext="{Binding ElementName=UI}" BorderBrush="{StaticResource ControlBrightDefaultBorderBrush}" BorderThickness="2" > |
| 21 | + |
21 | 22 | <StackPanel Margin="2" > |
22 | 23 | <Canvas Width="{Binding SchedulerOptions.Width}" Height="{Binding SchedulerOptions.Height}" MinHeight="512" MinWidth="512" ClipToBounds="True"> |
23 | 24 | <InkCanvas x:Name="PaintCanvas" Background="{Binding BackgroundBrush}" ForceCursor="True" Cursor="Pen" MinHeight="512" MinWidth="512" |
|
30 | 31 | DefaultDrawingAttributes="{Binding BrushAttributes}" /> |
31 | 32 | </Canvas> |
32 | 33 |
|
33 | | - <UniformGrid Columns="1" Height="30" Visibility="{Binding HasResult, Converter={StaticResource BooleanToHiddenConverter}}"> |
| 34 | + <UniformGrid Columns="2" Height="30" Margin="0,0,0,0"> |
34 | 35 |
|
35 | | - </UniformGrid> |
36 | | - <DockPanel Height="30"> |
37 | | - <Button DockPanel.Dock="Right" Command="{Binding ClearImageCommand}" BorderThickness="0,1,1,1" Width="50" > |
38 | | - <userControls:FontAwesome Icon="" IconStyle="Light" /> |
39 | | - </Button> |
| 36 | + <UniformGrid Columns="2"> |
40 | 37 |
|
41 | | - <DockPanel> |
42 | | - <Button DockPanel.Dock="Left" Command="{Binding LoadImageCommand}" ToolTip="Load Image File" Height="30" Width="150" > |
43 | | - <StackPanel Orientation="Horizontal"> |
44 | | - <userControls:FontAwesome Icon="" IconStyle="Light" Size="13" /> |
45 | | - <TextBlock Text="Load Image" Margin="5,0,0,0"/> |
46 | | - </StackPanel> |
47 | | - </Button> |
| 38 | + <!--Recent Colors--> |
| 39 | + <ListView ItemsSource="{Binding RecentColors, ElementName=ColorPickerControl}" SelectedValue="{Binding SelectedColor}" SelectedValuePath="Color" Background="Transparent" BorderBrush="Transparent"> |
| 40 | + <ListView.ItemContainerStyle> |
| 41 | + <Style TargetType="{x:Type ListViewItem}"> |
| 42 | + <Setter Property="Background"> |
| 43 | + <Setter.Value> |
| 44 | + <SolidColorBrush Color="{Binding Color}" /> |
| 45 | + </Setter.Value> |
| 46 | + </Setter> |
| 47 | + <Setter Property="Template"> |
| 48 | + <Setter.Value> |
| 49 | + <ControlTemplate TargetType="{x:Type ListViewItem}"> |
| 50 | + <Border BorderBrush="Transparent" BorderThickness="0" Margin="1" Background="White"> |
| 51 | + <Border Background="{TemplateBinding Background}"> |
| 52 | + <GridViewRowPresenter HorizontalAlignment="Stretch" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto" Margin="0" Content="{TemplateBinding Content}"/> |
| 53 | + </Border> |
| 54 | + </Border> |
| 55 | + </ControlTemplate> |
| 56 | + </Setter.Value> |
| 57 | + </Setter> |
| 58 | + <Style.Triggers> |
| 59 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Highlight"> |
| 60 | + <Setter Property="Opacity" Value=".6" /> |
| 61 | + </DataTrigger> |
| 62 | + </Style.Triggers> |
| 63 | + </Style> |
| 64 | + </ListView.ItemContainerStyle> |
| 65 | + <ListView.ItemsPanel> |
| 66 | + <ItemsPanelTemplate> |
| 67 | + <UniformGrid Rows="2" Columns="5" /> |
| 68 | + </ItemsPanelTemplate> |
| 69 | + </ListView.ItemsPanel> |
| 70 | + </ListView> |
48 | 71 |
|
49 | | - <xctk:ColorPicker |
50 | | - Width="80" |
| 72 | + <xctk:ColorPicker x:Name="ColorPickerControl" |
51 | 73 | DisplayColorAndName="False" |
52 | | - ShowRecentColors="True" |
| 74 | + ShowRecentColors="False" |
53 | 75 | SelectedColor="{Binding SelectedColor}" |
54 | | - ShowStandardColors="False" |
55 | | - ShowTabHeaders="False" |
| 76 | + RecentColors="{Binding RecentColors}" |
| 77 | + BorderBrush="{StaticResource ControlDefaultBorderBrush}" |
| 78 | + ShowTabHeaders="True" |
56 | 79 | ColorMode="ColorCanvas" |
| 80 | + Background="{StaticResource ControlDefaultBackground}" |
| 81 | + ShowDropDownButton="False" |
| 82 | + ShowStandardColors="False" |
| 83 | + DropDownBackground="{StaticResource ContainerBackground}" |
| 84 | + TabBackground="{StaticResource ControlDarkerBackground}" |
57 | 85 | AvailableColorsSortingMode="HueSaturationBrightness" > |
58 | 86 | </xctk:ColorPicker> |
59 | 87 |
|
60 | | - <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" > |
61 | | - <Button DockPanel.Dock="Right" Command="{Binding CanvasModeCommand}" Width="50" Visibility="{Binding IsEraserEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"> |
62 | | - <userControls:FontAwesome Icon="" IconStyle="Light" /> |
63 | | - </Button> |
64 | | - <Button DockPanel.Dock="Right" Command="{Binding CanvasModeCommand}" Width="50" Visibility="{Binding IsEraserEnabled, Converter={StaticResource InverseBooleanToVisibilityConverter}}"> |
65 | | - <userControls:FontAwesome Icon="" IconStyle="Light" /> |
66 | | - </Button> |
67 | | - </StackPanel> |
| 88 | + </UniformGrid> |
| 89 | + |
| 90 | + |
| 91 | + |
| 92 | + <UniformGrid Columns="5"> |
| 93 | + |
| 94 | + <!--Paint Brush--> |
| 95 | + <Button Command="{Binding SelectToolCommand}" CommandParameter="{x:Static local:DrawingTool.Brush}"> |
| 96 | + <userControls:FontAwesome Icon="" IconStyle="Light" > |
| 97 | + <userControls:FontAwesome.Style> |
| 98 | + <Style TargetType="{x:Type userControls:FontAwesome}" > |
| 99 | + <Setter Property="BorderThickness" Value="0" /> |
| 100 | + <Setter Property="Color" Value="{StaticResource ButtonForeground}" /> |
| 101 | + <Style.Triggers> |
| 102 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Brush" > |
| 103 | + <Setter Property="BorderThickness" Value="1" /> |
| 104 | + <Setter Property="Color" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 105 | + </DataTrigger> |
| 106 | + </Style.Triggers> |
| 107 | + </Style> |
| 108 | + </userControls:FontAwesome.Style> |
| 109 | + </userControls:FontAwesome> |
| 110 | + <Button.Style> |
| 111 | + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}" > |
| 112 | + <Setter Property="BorderThickness" Value="0" /> |
| 113 | + <Setter Property="BorderBrush" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 114 | + <Style.Triggers> |
| 115 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Brush" > |
| 116 | + <Setter Property="BorderThickness" Value="2" /> |
| 117 | + </DataTrigger> |
| 118 | + </Style.Triggers> |
| 119 | + </Style> |
| 120 | + </Button.Style> |
| 121 | + </Button> |
| 122 | + |
| 123 | + <!--Highlighter--> |
| 124 | + <Button Command="{Binding SelectToolCommand}" CommandParameter="{x:Static local:DrawingTool.Highlight}"> |
| 125 | + <userControls:FontAwesome Icon="" IconStyle="Light" > |
| 126 | + <userControls:FontAwesome.Style> |
| 127 | + <Style TargetType="{x:Type userControls:FontAwesome}" > |
| 128 | + <Setter Property="BorderThickness" Value="0" /> |
| 129 | + <Setter Property="Color" Value="{StaticResource ButtonForeground}" /> |
| 130 | + <Style.Triggers> |
| 131 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Highlight" > |
| 132 | + <Setter Property="BorderThickness" Value="1" /> |
| 133 | + <Setter Property="Color" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 134 | + </DataTrigger> |
| 135 | + </Style.Triggers> |
| 136 | + </Style> |
| 137 | + </userControls:FontAwesome.Style> |
| 138 | + </userControls:FontAwesome> |
| 139 | + <Button.Style> |
| 140 | + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}" > |
| 141 | + <Setter Property="BorderThickness" Value="0" /> |
| 142 | + <Setter Property="BorderBrush" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 143 | + <Style.Triggers> |
| 144 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Highlight" > |
| 145 | + <Setter Property="BorderThickness" Value="2" /> |
| 146 | + </DataTrigger> |
| 147 | + </Style.Triggers> |
| 148 | + </Style> |
| 149 | + </Button.Style> |
| 150 | + </Button> |
| 151 | + |
| 152 | + |
| 153 | + <!--Eraser--> |
| 154 | + <Button Command="{Binding SelectToolCommand}" CommandParameter="{x:Static local:DrawingTool.Eraser}"> |
| 155 | + <userControls:FontAwesome Icon="" IconStyle="Light" > |
| 156 | + <userControls:FontAwesome.Style> |
| 157 | + <Style TargetType="{x:Type userControls:FontAwesome}" > |
| 158 | + <Setter Property="BorderThickness" Value="0" /> |
| 159 | + <Setter Property="Color" Value="{StaticResource ButtonForeground}" /> |
| 160 | + <Style.Triggers> |
| 161 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Eraser" > |
| 162 | + <Setter Property="BorderThickness" Value="1" /> |
| 163 | + <Setter Property="Color" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 164 | + </DataTrigger> |
| 165 | + </Style.Triggers> |
| 166 | + </Style> |
| 167 | + </userControls:FontAwesome.Style> |
| 168 | + </userControls:FontAwesome> |
| 169 | + <Button.Style> |
| 170 | + <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}" > |
| 171 | + <Setter Property="BorderThickness" Value="0" /> |
| 172 | + <Setter Property="BorderBrush" Value="{StaticResource ControlPrimaryColourBackground}" /> |
| 173 | + <Style.Triggers> |
| 174 | + <DataTrigger Binding="{Binding CanvasDrawingTool, ElementName=UI}" Value="Eraser" > |
| 175 | + <Setter Property="BorderThickness" Value="2" /> |
| 176 | + </DataTrigger> |
| 177 | + </Style.Triggers> |
| 178 | + </Style> |
| 179 | + </Button.Style> |
| 180 | + </Button> |
| 181 | + |
| 182 | + |
| 183 | + <!--Fill--> |
| 184 | + <Button Command="{Binding FillCanvasCommand}"> |
| 185 | + <userControls:FontAwesome Icon="" IconStyle="Light" /> |
| 186 | + </Button> |
| 187 | + |
| 188 | + <!--Clear--> |
| 189 | + <Button Command="{Binding ClearCanvasCommand}"> |
| 190 | + <userControls:FontAwesome Icon="" IconStyle="Light" /> |
| 191 | + </Button> |
| 192 | + </UniformGrid> |
| 193 | + |
| 194 | + </UniformGrid> |
| 195 | + |
| 196 | + <UniformGrid Columns="3" Height="30"> |
68 | 197 |
|
69 | | - <StackPanel Margin="0,0,5,0" > |
70 | | - <UniformGrid Columns="2" > |
71 | | - <TextBlock Text="Pen Size" VerticalAlignment="Bottom" FontSize="8" Margin="5,-4,6,0" Opacity=".6" FontStyle="Italic" /> |
72 | | - <TextBlock Text="{Binding ElementName=SliderMaskDrawSize, Path=Value, StringFormat={}{0}}" VerticalAlignment="Bottom" FontSize="8" Margin="0,-4,6,0" FontWeight="Medium" HorizontalAlignment="Right" /> |
73 | | - </UniformGrid> |
74 | | - <Slider Name="SliderMaskDrawSize" Value="{Binding BrushDrawSize}" Minimum="2" Maximum="40" TickFrequency="1" IsSnapToTickEnabled="True" SmallChange="1" LargeChange="1" > |
75 | | - <i:Interaction.Behaviors> |
76 | | - <behaviors:SliderMouseWheelBehavior /> |
77 | | - </i:Interaction.Behaviors> |
78 | | - </Slider> |
| 198 | + <!--Load Image--> |
| 199 | + <Button DockPanel.Dock="Left" Command="{Binding LoadImageCommand}" ToolTip="Load Image File" Height="30" > |
| 200 | + <StackPanel Orientation="Horizontal"> |
| 201 | + <userControls:FontAwesome Icon="" IconStyle="Light" Size="13" /> |
| 202 | + <TextBlock Text="Load Image" Margin="5,0,0,0"/> |
79 | 203 | </StackPanel> |
80 | | - </DockPanel> |
| 204 | + </Button> |
| 205 | + |
81 | 206 |
|
82 | | - </DockPanel> |
| 207 | + <StackPanel> |
| 208 | + </StackPanel> |
| 209 | + |
| 210 | + <!--Tool Size--> |
| 211 | + <StackPanel Margin="0,5,0,0" > |
| 212 | + <UniformGrid Columns="2" > |
| 213 | + <TextBlock Text="Tool Size" VerticalAlignment="Bottom" FontSize="8" Margin="5,-4,6,0" Opacity=".6" FontStyle="Italic" /> |
| 214 | + <TextBlock Text="{Binding ElementName=SliderMaskDrawSize, Path=Value, StringFormat={}{0}}" VerticalAlignment="Bottom" FontSize="8" Margin="0,-4,6,0" FontWeight="Medium" HorizontalAlignment="Right" /> |
| 215 | + </UniformGrid> |
| 216 | + <Slider Name="SliderMaskDrawSize" Value="{Binding DrawingToolSize}" Minimum="1" Maximum="40" TickFrequency="1" IsSnapToTickEnabled="True" SmallChange="1" LargeChange="1" > |
| 217 | + <i:Interaction.Behaviors> |
| 218 | + <behaviors:SliderMouseWheelBehavior /> |
| 219 | + </i:Interaction.Behaviors> |
| 220 | + </Slider> |
| 221 | + </StackPanel> |
| 222 | + |
| 223 | + </UniformGrid> |
83 | 224 | </StackPanel> |
84 | 225 | </Border> |
85 | 226 | </UserControl> |
0 commit comments