Added Minimize/Maximize/Close Buttons and took WindowStyle
This commit is contained in:
@@ -8,7 +8,6 @@ namespace SimpleDraw.Models;
|
|||||||
public class DrawingPoints : ObservableObject
|
public class DrawingPoints : ObservableObject
|
||||||
{
|
{
|
||||||
private ObservableCollection<Point> _drawingPoints = new ObservableCollection<Point>();
|
private ObservableCollection<Point> _drawingPoints = new ObservableCollection<Point>();
|
||||||
// private ObservableCollection<ObservableCollection<Point>> _drawingPointsList = new ObservableCollection<ObservableCollection<Point>>();
|
|
||||||
|
|
||||||
private Brush _brush;
|
private Brush _brush;
|
||||||
private double _brushThickness;
|
private double _brushThickness;
|
||||||
@@ -36,12 +35,4 @@ public class DrawingPoints : ObservableObject
|
|||||||
Brush = brush;
|
Brush = brush;
|
||||||
BrushThickness = brushThickness;
|
BrushThickness = brushThickness;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
public ObservableCollection<ObservableCollection<Point>> DrawingPointsList
|
|
||||||
{
|
|
||||||
get => _drawingPointsList;
|
|
||||||
set => SetProperty(ref _drawingPointsList, value);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,9 @@ public class MainWindowViewModel : ViewModelBase
|
|||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
DisplaySplitEvent = new RelayCommand(DisplaySplit);
|
DisplaySplitEvent = new RelayCommand(DisplaySplit);
|
||||||
|
CloseAppEvent = new RelayCommand(CloseApp);
|
||||||
|
MaximizeAppEvent = new RelayCommand(MaximizeApp);
|
||||||
|
MinimizeAppEvent = new RelayCommand(MinimizeApp);
|
||||||
|
|
||||||
ColorPalette =
|
ColorPalette =
|
||||||
[
|
[
|
||||||
|
|||||||
@@ -74,4 +74,33 @@ public class ViewModelBase : ObservableObject
|
|||||||
{
|
{
|
||||||
IsSplitOpen = !IsSplitOpen;
|
IsSplitOpen = !IsSplitOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WindowState _windowStateProperty;
|
||||||
|
|
||||||
|
public WindowState WindowStateProperty
|
||||||
|
{
|
||||||
|
get => _windowStateProperty;
|
||||||
|
set => SetProperty(ref _windowStateProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IRelayCommand CloseAppEvent { get; protected set; }
|
||||||
|
|
||||||
|
protected void CloseApp()
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IRelayCommand MaximizeAppEvent { get; protected set; }
|
||||||
|
|
||||||
|
protected void MaximizeApp()
|
||||||
|
{
|
||||||
|
WindowStateProperty = WindowState.Maximized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IRelayCommand MinimizeAppEvent { get; protected set; }
|
||||||
|
|
||||||
|
protected void MinimizeApp()
|
||||||
|
{
|
||||||
|
WindowStateProperty = WindowState.Minimized;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+70
-21
@@ -18,6 +18,9 @@
|
|||||||
Title="SimpleDraw"
|
Title="SimpleDraw"
|
||||||
Width="{Binding WindowWidth}"
|
Width="{Binding WindowWidth}"
|
||||||
Height="{Binding WindowHeight}"
|
Height="{Binding WindowHeight}"
|
||||||
|
WindowState="{Binding WindowStateProperty, Mode=TwoWay}"
|
||||||
|
SystemDecorations="None"
|
||||||
|
ExtendClientAreaToDecorationsHint="True"
|
||||||
MinWidth="400"
|
MinWidth="400"
|
||||||
MinHeight="300"
|
MinHeight="300"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
@@ -39,28 +42,13 @@
|
|||||||
<Grid Background="#66ffffff">
|
<Grid Background="#66ffffff">
|
||||||
<Grid Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="25"></RowDefinition>
|
<RowDefinition Height="50*"></RowDefinition>
|
||||||
<RowDefinition Height="50*"></RowDefinition>
|
<RowDefinition Height="50*"></RowDefinition>
|
||||||
<RowDefinition Height="50*"></RowDefinition>
|
<RowDefinition Height="50*"></RowDefinition>
|
||||||
<RowDefinition Height="50*"></RowDefinition>
|
<RowDefinition Height="50*"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DockPanel Grid.Row="0" Background="Transparent">
|
<StackPanel Grid.Row="0">
|
||||||
<Menu DockPanel.Dock="Top" Background="Transparent" HorizontalAlignment="Left">
|
<TextBox Text="Select Color:" IsHitTestVisible="False" IsReadOnly="True" BorderThickness="0" Background="Transparent" Margin="0,5,5,-5"/>
|
||||||
<MenuItem Header="_File">
|
|
||||||
<MenuItem Header="_Open..."/>
|
|
||||||
<Separator/>
|
|
||||||
<MenuItem Header="_Exit"/>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem Header="_Edit">
|
|
||||||
<MenuItem Header="Copy"/>
|
|
||||||
<MenuItem Header="Paste"/>
|
|
||||||
</MenuItem>
|
|
||||||
</Menu>
|
|
||||||
<Button DockPanel.Dock="Top" HorizontalAlignment="Right">X</Button>
|
|
||||||
</DockPanel>
|
|
||||||
|
|
||||||
<StackPanel Grid.Row="1">
|
|
||||||
<TextBox Text="Select Color:" IsHitTestVisible="False" IsReadOnly="True" BorderThickness="0" Background="Transparent"/>
|
|
||||||
<ItemsControl ItemsSource="{Binding ColorPalette}">
|
<ItemsControl ItemsSource="{Binding ColorPalette}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@@ -82,11 +70,14 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</ItemsControl.ItemTemplate>
|
</ItemsControl.ItemTemplate>
|
||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
<TextBox HorizontalAlignment="Left" TextAlignment="Left" Margin="5,5,5,0" IsHitTestVisible="False" IsReadOnly="True" BorderThickness="0" Background="Transparent">
|
<!-- Colorpicker -->
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Row="1">
|
||||||
|
<TextBox HorizontalAlignment="Left" TextAlignment="Left" Margin="0,5,5,-5" IsHitTestVisible="False" IsReadOnly="True" BorderThickness="0" Background="Transparent">
|
||||||
Brush Size:
|
Brush Size:
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<TextBox Text="{Binding BrushThickness, Mode=TwoWay}" Margin="5,0" HorizontalAlignment="Stretch" TextAlignment="Left" BorderThickness="2" Background="Transparent"></TextBox>
|
<TextBox Text="{Binding BrushThickness, Mode=TwoWay}" Margin="5,0" HorizontalAlignment="Stretch" TextAlignment="Left" BorderThickness="2" Background="Transparent"></TextBox>
|
||||||
<Slider Margin="5, 0" Value="{Binding BrushThickness}" Maximum="50" Minimum="0.5"></Slider>
|
<Slider Margin="10, -5, 10, 0" Value="{Binding BrushThickness}" Maximum="50" Minimum="0.5"></Slider>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -144,7 +135,18 @@
|
|||||||
<!-- left Info bar -->
|
<!-- left Info bar -->
|
||||||
<StackPanel Width="30" HorizontalAlignment="Left" IsVisible="{Binding !IsSplitOpen}" Background="#d4d4fc">
|
<StackPanel Width="30" HorizontalAlignment="Left" IsVisible="{Binding !IsSplitOpen}" Background="#d4d4fc">
|
||||||
<!-- Menu-Opener -->
|
<!-- Menu-Opener -->
|
||||||
<Button Content="≡" Command="{Binding DisplaySplitEvent}" HorizontalAlignment="Center" VerticalAlignment="Top">
|
<Button Content="≡"
|
||||||
|
Command="{Binding DisplaySplitEvent}"
|
||||||
|
HorizontalAlignment="Center"
|
||||||
|
VerticalAlignment="Top"
|
||||||
|
FontSize="18"
|
||||||
|
Width="25"
|
||||||
|
Height="25"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Padding="0,-6,0,0"
|
||||||
|
Margin="0,5,0,0"
|
||||||
|
>
|
||||||
<Button.RenderTransform>
|
<Button.RenderTransform>
|
||||||
<TranslateTransform X="{Binding ButtonOffset}" />
|
<TranslateTransform X="{Binding ButtonOffset}" />
|
||||||
</Button.RenderTransform>
|
</Button.RenderTransform>
|
||||||
@@ -190,5 +192,52 @@
|
|||||||
>
|
>
|
||||||
🖫
|
🖫
|
||||||
</Button>
|
</Button>
|
||||||
|
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,7.5,7.5,0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="25"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="25"></ColumnDefinition>
|
||||||
|
<ColumnDefinition Width="25"></ColumnDefinition>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Button Grid.Column="2"
|
||||||
|
Margin="0,0,0,0"
|
||||||
|
Padding="0"
|
||||||
|
CornerRadius="0,5,5,0"
|
||||||
|
Background="#d4d4ff"
|
||||||
|
FontSize="12"
|
||||||
|
Width="25"
|
||||||
|
Height="25"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Command="{Binding CloseAppEvent}"
|
||||||
|
>
|
||||||
|
X
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="1"
|
||||||
|
Padding="0"
|
||||||
|
Background="#d4d4ff"
|
||||||
|
FontSize="12"
|
||||||
|
Width="25"
|
||||||
|
Height="25"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Command="{Binding MaximizeAppEvent}"
|
||||||
|
>
|
||||||
|
🗖
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Column="0"
|
||||||
|
Margin="0,0,0,0"
|
||||||
|
Padding="0"
|
||||||
|
CornerRadius="5,0,0,5"
|
||||||
|
Background="#d4d4ff"
|
||||||
|
FontSize="12"
|
||||||
|
Width="25"
|
||||||
|
Height="25"
|
||||||
|
HorizontalContentAlignment="Center"
|
||||||
|
VerticalContentAlignment="Center"
|
||||||
|
Command="{Binding MinimizeAppEvent}"
|
||||||
|
>
|
||||||
|
🗕
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
</Panel>
|
</Panel>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
Reference in New Issue
Block a user