-
-
Notifications
You must be signed in to change notification settings - Fork 194
/
Copy pathMainPage.xaml
116 lines (109 loc) · 7.54 KB
/
MainPage.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:mct="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
xmlns:vm="clr-namespace:MauiPaint"
x:Class="MauiPaint.MainPage"
x:DataType="vm:MainPageViewModel">
<ContentPage.MenuBarItems>
<MenuBarItem Text="File">
<MenuFlyoutItem Text="New" Command="{Binding NewCommand}"/>
<MenuFlyoutItem Text="Open" Command="{Binding OpenCommand}"/>
<MenuFlyoutItem Text="Save Project" Command="{Binding SaveCommand}"/>
<MenuFlyoutItem Text="Save Image" Command="{Binding SaveImageCommand}"/>
<MenuFlyoutItem Text="Quit" Command="{Binding QuitCommand}"/>
</MenuBarItem>
<MenuBarItem Text="View">
<MenuFlyoutItem Text="Toggle Light/Dark Mode" Command="{Binding ToggleThemeCommand}"/>
</MenuBarItem>
<MenuBarItem Text="Tools">
<MenuFlyoutItem Text="Paste from Clipboard" Command="{Binding PasteFromClipboardCommand}"/>
<MenuFlyoutItem Text="Preview image" Command="{Binding PreviewImageCommand}"/>
</MenuBarItem>
<MenuBarItem Text="Help">
<MenuFlyoutItem Text="Help" Command="{Binding HelpCommand}"/>
<MenuFlyoutItem Text="About" Command="{Binding AboutCommand}"/>
</MenuBarItem>
</ContentPage.MenuBarItems>
<Grid ColumnDefinitions="200, *" ColumnSpacing="10">
<Border Grid.Column="0"
Stroke="Gray"
StrokeThickness="5">
<Border.StrokeShape>
<RoundRectangle CornerRadius="10"/>
</Border.StrokeShape>
<ScrollView Padding="10">
<VerticalStackLayout Spacing="10">
<Label Text="Background"/>
<mct:UniformItemsLayout>
<Button BackgroundColor="Red" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Green" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Blue" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Yellow" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Gray" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Black" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="White" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Pink" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Brown" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Purple" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="SkyBlue" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Orange" Command="{Binding SetBackgroundCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
</mct:UniformItemsLayout>
<Label Text="Line width"/>
<Slider Maximum="100" Minimum="1" Value="{Binding LineWidth}"/>
<Label Text="Line color"/>
<mct:UniformItemsLayout>
<Button BackgroundColor="Red" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Green" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Blue" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Yellow" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Gray" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Black" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="White" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Pink" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Brown" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Purple" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="SkyBlue" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
<Button BackgroundColor="Orange" Command="{Binding SetLineColorCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=BackgroundColor}"/>
</mct:UniformItemsLayout>
<Label Text="Eraser"/>
<Button Background="{Binding Background}" Command="{Binding SetEraserCommand}"/>
<Label Text="Figures"/>
<mct:UniformItemsLayout>
<Button Text="Rectangle" Command="{Binding AddFigureCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=Text}"/>
<Button Text="Ellipse" Command="{Binding AddFigureCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=Text}"/>
<Button Text="Text" Command="{Binding AddFigureCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=Text}"/>
<Button Text="Image" Command="{Binding AddFigureCommand}" CommandParameter="{Binding Source={RelativeSource Self}, Path=Text}"
ToolTipProperties.Text="Doesn't work on Windows"/>
</mct:UniformItemsLayout>
<Label Text="Rotate"/>
<Slider x:Name="RotateSlider" Maximum="360">
<Slider.Behaviors>
<mct:EventToCommandBehavior
BindingContext="{Binding Path=BindingContext, Source={x:Reference RotateSlider}, x:DataType=Slider}"
EventName="ValueChanged"
Command="{Binding RotateCommand}"
CommandParameter="{Binding Path=Value, Source={x:Reference RotateSlider}}"/>
</Slider.Behaviors>
</Slider>
</VerticalStackLayout>
</ScrollView>
</Border>
<mct:DrawingView x:Name="DrawingView"
Grid.Column="1"
Lines="{Binding Lines}"
Background="{Binding Background}"
LineColor="{Binding LineColor}"
LineWidth="{Binding LineWidth}"
IsMultiLineModeEnabled="True"
DrawAction="{Binding DrawAction}"
Width="{Binding CanvasWidth, Mode=OneWayToSource}"
Height="{Binding CanvasHeight, Mode=OneWayToSource}">
<FlyoutBase.ContextFlyout>
<MenuFlyout>
<MenuFlyoutItem Text="Clear" Command="{Binding NewCommand}"/>
</MenuFlyout>
</FlyoutBase.ContextFlyout>
</mct:DrawingView>
</Grid>
</ContentPage>