wip
This commit is contained in:
@@ -6,22 +6,24 @@
|
||||
xmlns:views="clr-namespace:ClientApp.Views"
|
||||
StartupUri="Views/MainWindow.xaml">
|
||||
<Application.Resources>
|
||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||
<views:MainView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||
<views:LoginView />
|
||||
<!-- This is a UserControl -->
|
||||
</DataTemplate>
|
||||
|
||||
|
||||
<ResourceDictionary>
|
||||
<DataTemplate DataType="{x:Type viewModels:MainViewModel}">
|
||||
<views:MainView />
|
||||
<!-- This is a Page -->
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewModels:LoginViewModel}">
|
||||
<views:LoginView />
|
||||
<!-- This is a Page -->
|
||||
</DataTemplate>
|
||||
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<!--<ResourceDictionary Source="Styles/Fonts.xaml"/>-->
|
||||
<ResourceDictionary Source="Styles/Fonts.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Colors.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Buttons.xaml"/>
|
||||
<!--<ResourceDictionary Source="Styles/Texts.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Windows.xaml"/>-->
|
||||
<ResourceDictionary Source="Styles/Texts.xaml"/>
|
||||
<ResourceDictionary Source="Styles/Windows.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
||||
@@ -7,6 +7,24 @@
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Images\Logo\icon1.ico" />
|
||||
<None Remove="Images\re15.jpg" />
|
||||
<None Remove="Images\stone.png" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Images\Logo\icon1.ico">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\re15.jpg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\stone.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AsyncAwaitBestPractices.MVVM" Version="4.3.0" />
|
||||
<PackageReference Include="MvvmLightLibsStd10" Version="5.4.1.1" />
|
||||
|
||||
@@ -19,4 +19,47 @@
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="SystemIconButton" BasedOn="{StaticResource Hoverless}" >
|
||||
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
|
||||
<Setter Property="Padding" Value="4"/>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="WindowControlButton">
|
||||
<Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="VerticalAlignment" Value="Stretch"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource ForegroundMainBrush}"/>
|
||||
<Setter Property="Padding" Value="6"/>
|
||||
|
||||
<Setter Property="LayoutTransform">
|
||||
<Setter.Value>
|
||||
<ScaleTransform ScaleX="2"/>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Button}">
|
||||
<Border Padding="{TemplateBinding Padding}" Background="{TemplateBinding Background}">
|
||||
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{StaticResource BackgroundSemiLightBrush}"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}" x:Key="WindowCloseButton" BasedOn="{StaticResource WindowControlButton}">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="Red"/>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -9,6 +9,9 @@
|
||||
<Color x:Key="BackgroundVeryLight">#fafafa</Color>
|
||||
<SolidColorBrush x:Key="BackgroundVeryLightBrush" Color="{StaticResource BackgroundVeryLight}"/>
|
||||
|
||||
<Color x:Key="BackgroundSemiLight">#d7d7d7</Color>
|
||||
<SolidColorBrush x:Key="BackgroundSemiLightBrush" Color="{StaticResource BackgroundSemiLight}"/>
|
||||
|
||||
<Color x:Key="ForegroundMain">#686868</Color>
|
||||
<SolidColorBrush x:Key="ForegroundMainBrush" Color="{StaticResource ForegroundMain}"/>
|
||||
|
||||
@@ -18,4 +21,5 @@
|
||||
<Color x:Key="ForegroundWhite">#fff</Color>
|
||||
<SolidColorBrush x:Key="ForegroundWhiteBrush" Color="{StaticResource ForegroundWhite}"/>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -2,4 +2,10 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:ClientApp">
|
||||
|
||||
<Style TargetType="{x:Type TextBlock}" x:Key="HeaderText">
|
||||
<Setter Property="Foreground" Value="{StaticResource ForegroundMainBrush}"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="Margin" Value="0 4"/>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
@@ -1,9 +1,12 @@
|
||||
using ClientApp.Models;
|
||||
using ClientApp.Utils;
|
||||
using GalaSoft.MvvmLight.Command;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace ClientApp.ViewModels
|
||||
{
|
||||
@@ -18,6 +21,18 @@ namespace ClientApp.ViewModels
|
||||
|
||||
#endregion
|
||||
|
||||
#region commands
|
||||
|
||||
public ICommand MinimizeCommand { get; set; }
|
||||
|
||||
public ICommand MaximizeCommand { get; set; }
|
||||
|
||||
public ICommand CloseCommand { get; set; }
|
||||
|
||||
public ICommand MenuCommand { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region public properties
|
||||
public Info InfoModel { get; set; }
|
||||
|
||||
@@ -28,6 +43,11 @@ namespace ClientApp.ViewModels
|
||||
/// <summary>
|
||||
/// size of the resize border around the window
|
||||
/// </summary>
|
||||
|
||||
public double MinimumWidth { get; set; } = 250;
|
||||
|
||||
public double MinimumHeight { get; set; } = 250;
|
||||
|
||||
public int ResizeBorder { get; set; } = 6;
|
||||
|
||||
public Thickness ResizeBorderThickness { get { return new Thickness(ResizeBorder + OuterMarginSize); } }
|
||||
@@ -84,7 +104,23 @@ namespace ClientApp.ViewModels
|
||||
LoginViewModel loginViewModel = new LoginViewModel(this);
|
||||
SelectedViewModel = loginViewModel;
|
||||
this.client.SetLoginViewModel(loginViewModel);
|
||||
|
||||
this.MinimizeCommand = new RelayCommand(() => this.mWindow.WindowState = WindowState.Minimized);
|
||||
this.MaximizeCommand = new RelayCommand(() => this.mWindow.WindowState ^= WindowState.Maximized);
|
||||
this.CloseCommand = new RelayCommand(() => this.mWindow.Close());
|
||||
this.MenuCommand = new RelayCommand(() => SystemCommands.ShowSystemMenu(this.mWindow, GetMousePosition()));
|
||||
}
|
||||
|
||||
|
||||
#region helper
|
||||
|
||||
private Point GetMousePosition()
|
||||
{
|
||||
Debug.WriteLine("getmousePosition called");
|
||||
var p = Mouse.GetPosition(this.mWindow);
|
||||
return new Point(p.X + this.mWindow.Left, p.Y + this.mWindow.Top);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
xmlns:viewModels="clr-namespace:ClientApp.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<DockPanel Background="Lime">
|
||||
<!--<DockPanel.Background>
|
||||
<ImageBrush TileMode="Tile" ViewportUnits="Absolute" Viewport="0 0 256 256" ImageSource="\images\stone.png"/>
|
||||
</DockPanel.Background>-->
|
||||
<DockPanel>
|
||||
<DockPanel.Background>
|
||||
<ImageBrush TileMode="Tile" ViewportUnits="Absolute" Viewport="0 0 64 64" ImageSource="\images\stone.png"/>
|
||||
</DockPanel.Background>
|
||||
<StackPanel VerticalAlignment="Center" Width="auto">
|
||||
<Label Content="Username" HorizontalContentAlignment="Center" />
|
||||
<TextBox x:Name="Username" Text="{Binding Username}" TextWrapping="Wrap" Width="120"/>
|
||||
|
||||
@@ -11,9 +11,10 @@
|
||||
AllowsTransparency="True"
|
||||
x:Name="applicatonWindow"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
MinHeight="{Binding MinimumHeight}"
|
||||
MinWidth="{Binding MinimumWidth}"
|
||||
Title="Whaazzzzuuuuuuuup"
|
||||
Width="500"
|
||||
Height="500">
|
||||
>
|
||||
<!--Icon="pack://application:,,,/Images/Log/icon1_small.ico"-->
|
||||
|
||||
<Window.Resources>
|
||||
@@ -23,13 +24,27 @@
|
||||
<ControlTemplate TargetType="{x:Type Window}">
|
||||
<Border Padding="{Binding OuterMarginThickness, FallbackValue=10}" >
|
||||
<Grid>
|
||||
|
||||
<!-- opacity mask -->
|
||||
<Border x:Name="Container"
|
||||
Background="{StaticResource BackgroundLightBrush}"
|
||||
CornerRadius="{Binding WindowCornerRadius, FallbackValue=10}"/>
|
||||
|
||||
|
||||
<Border CornerRadius="{Binding WindowCornerRadius, FallbackValue=10}"
|
||||
Background="#efefef">
|
||||
Background="{StaticResource BackgroundVeryLightBrush}">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect ShadowDepth="0" Opacity="0.2"/>
|
||||
</Border.Effect>
|
||||
</Border>
|
||||
|
||||
|
||||
<Grid>
|
||||
|
||||
<Grid.OpacityMask>
|
||||
<VisualBrush Visual="{Binding ElementName=Container}"/>
|
||||
</Grid.OpacityMask>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="{Binding TitleHeightGridLength, FallbackValue=42}"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
@@ -38,7 +53,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Title bar -->
|
||||
<Grid Grid.Column="0" Grid.Row="0" Panel.ZIndex="1" Background="Red">
|
||||
<Grid Grid.Column="0" Grid.Row="0" Panel.ZIndex="1" Background="{StaticResource BackgroundLightBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -46,11 +61,41 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- icon -->
|
||||
<Button Style="{StaticResource Hoverless}" WindowChrome.IsHitTestVisibleInChrome="True" Command="{Binding MenuCommand}">
|
||||
<Image Source="/Images/Stone.png"/>
|
||||
<Button Grid.Column="0" Style="{StaticResource SystemIconButton}" Command="{Binding MenuCommand}">
|
||||
<Image Source="/Images/Logo/icon1.ico"/>
|
||||
<!--<TextBlock Text="icon"/>-->
|
||||
</Button>
|
||||
|
||||
<!-- Title -->
|
||||
<Viewbox Grid.Column="1" Margin="0">
|
||||
<TextBlock Style="{StaticResource HeaderText}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Title, FallbackValue=failed}"/>
|
||||
</Viewbox>
|
||||
|
||||
<!-- Window buttons -->
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button Style="{StaticResource WindowControlButton}" Content="_" Command="{Binding MinimizeCommand}"/>
|
||||
<Button Style="{StaticResource WindowControlButton}" Content="[]" Command="{Binding MaximizeCommand}"/>
|
||||
<Button Style="{StaticResource WindowCloseButton}" Content="X" Command="{Binding CloseCommand}"/>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
<Border Grid.Row="1" Height="6" BorderThickness="0 0.2 0 0">
|
||||
<Border.BorderBrush>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
|
||||
<GradientStop Color="{StaticResource BackgroundSemiLight}" Offset="0.0"/>
|
||||
<GradientStop Color="{StaticResource BackgroundVeryLight}" Offset="1.0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.BorderBrush>
|
||||
|
||||
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
|
||||
<GradientStop Color="{StaticResource BackgroundVeryLight}" Offset="1.0"/>
|
||||
<GradientStop Color="{StaticResource BackgroundSemiLight}" Offset="0.0"/>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -68,8 +113,8 @@
|
||||
GlassFrameThickness="0"/>
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<!--<Grid>
|
||||
<Grid>
|
||||
<Frame Content="{Binding SelectedViewModel}" Focusable="False"/>
|
||||
<Label Content="gemaakt door: mensen" DockPanel.Dock="Bottom" HorizontalAlignment="Right" VerticalAlignment="Bottom" FontStyle="Italic" Foreground="Gray"/>
|
||||
</Grid>-->
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
Reference in New Issue
Block a user