Skip to content

Commit

Permalink
try another style
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianHock committed Oct 2, 2023
1 parent 529b57d commit a73bd02
Show file tree
Hide file tree
Showing 11 changed files with 156 additions and 94 deletions.
30 changes: 25 additions & 5 deletions Kreditrechner/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,41 @@
</LinearGradientBrush>

<Style TargetType="{x:Type Control}" x:Key="StandardFont">
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="FontFamily" Value="Fonts/#Dosis"/>
<Setter Property="FontSize" Value="18"/>
<Setter Property="FontWeight" Value="Medium"/>
<Setter Property="Foreground" Value="White"/>
</Style>

<Style TargetType="{x:Type Control}" x:Key="StandardMenuItemFont">
<Setter Property="FontFamily" Value="Arial"/>
<Setter Property="FontFamily" Value="Fonts/#Dosis"/>
<Setter Property="FontSize" Value="14"/>
</Style>

<Style TargetType="Label" BasedOn="{StaticResource ResourceKey=StandardFont}"/>

<Style TargetType="TextBox" BasedOn="{StaticResource ResourceKey=StandardFont}"/>
<Style TargetType="TextBox" BasedOn="{StaticResource ResourceKey=StandardFont}">
<Setter Property="Background" Value="#383660"/>
</Style>

<Style TargetType="Button" BasedOn="{StaticResource ResourceKey=StandardFont}"/>
<Style TargetType="Button" BasedOn="{StaticResource ResourceKey=StandardFont}">
<Setter Property="Background" Value="#FE6584"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF4C70"/>
</Trigger>
</Style.Triggers>
</Style>

<ControlTemplate x:Key="ButtonTemplate" TargetType="Button">
<Border Width="100" Height="25"
CornerRadius="12"
Background="{TemplateBinding Background}">
<ContentPresenter VerticalAlignment="Center"
HorizontalAlignment="Center"/>
</Border>
</ControlTemplate>

<Style TargetType="ComboBox" BasedOn="{StaticResource ResourceKey=StandardFont}"/>

<Style TargetType="TabItem" BasedOn="{StaticResource ResourceKey=StandardFont}"/>
Expand Down
Binary file added Kreditrechner/Fonts/Dosis.ttf
Binary file not shown.
1 change: 1 addition & 0 deletions Kreditrechner/Kreditrechner.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.en.resx" />
<Resource Include="Fonts\Dosis.ttf" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
Expand Down
78 changes: 51 additions & 27 deletions Kreditrechner/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d"
Title="{x:Static loc:Resources.Title}" MinHeight="450" Height="650" MinWidth="1200" Width="1200" WindowStartupLocation="CenterScreen"
d:DataContext="{d:DesignInstance vm:MainWindowViewModel, IsDesignTimeCreatable=True}">
d:DataContext="{d:DesignInstance vm:MainWindowViewModel, IsDesignTimeCreatable=True}"
Background="#181735"
WindowStyle="None"
ResizeMode="NoResize"
AllowsTransparency="True">

<Window.Resources>
<vc:CurrencyConverter x:Key="currencyConverter"/>
Expand All @@ -20,7 +24,7 @@
<vc:DateConverter x:Key="dateConverter"/>
</Window.Resources>

<Grid>
<Grid MouseDown="Menu_MouseDown">
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
Expand All @@ -37,34 +41,54 @@
<Border Grid.Row="4" Grid.RowSpan="2" Grid.Column="0" BorderBrush="Black" BorderThickness="0.5"/>
<Border Grid.Row="4" Grid.RowSpan="2" Grid.Column="1" BorderBrush="Black" BorderThickness="0.5"/>

<Menu Grid.ColumnSpan="2">
<MenuItem Header="{x:Static loc:Resources.MenuBarFile}">
<MenuItem Header="{x:Static loc:Resources.MenuBarLoad}" Command="{Binding LoadCommand}">
<MenuItem.Icon>
<Image Source="Icons/load.png"/>
</MenuItem.Icon>
<Grid Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>

<Menu Background="#181735" Foreground="White">
<Menu.Resources>
<Style TargetType="MenuItem">
<Setter Property="Background" Value="#181735"/>
</Style>
</Menu.Resources>
<MenuItem Header="{x:Static loc:Resources.MenuBarFile}">
<MenuItem Header="{x:Static loc:Resources.MenuBarLoad}" Command="{Binding LoadCommand}">
<MenuItem.Icon>
<Image Source="Icons/load.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="{x:Static loc:Resources.MenuBarSave}" Command="{Binding SaveCommand}">
<MenuItem.Icon>
<Image Source="Icons/save.png"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static loc:Resources.MenuBarSave}" Command="{Binding SaveCommand}">
<MenuItem.Icon>
<Image Source="Icons/save.png"/>
</MenuItem.Icon>
<MenuItem Header="{x:Static loc:Resources.MenuBarExtras}">
<MenuItem Header="{x:Static loc:Resources.MenuBarCalculateMinimumRate}" Command="{Binding MinimumRepaymentCommand}">
<MenuItem.Icon>
<Image Source="Icons/euro.png"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static loc:Resources.MenuBarExtras}">
<MenuItem Header="{x:Static loc:Resources.MenuBarCalculateMinimumRate}" Command="{Binding MinimumRepaymentCommand}">
<MenuItem.Icon>
<Image Source="Icons/euro.png"/>
</MenuItem.Icon>
<MenuItem Header="{x:Static loc:Resources.MenuBarHelp}">
<MenuItem Header="{x:Static loc:Resources.MenuBarAbout}" Click="InfoClicked">
<MenuItem.Icon>
<Image Source="Icons/info.png"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</MenuItem>
<MenuItem Header="{x:Static loc:Resources.MenuBarHelp}">
<MenuItem Header="{x:Static loc:Resources.MenuBarAbout}" Click="InfoClicked">
<MenuItem.Icon>
<Image Source="Icons/info.png"/>
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</Menu>
</Menu>

<StackPanel Grid.Column="1" Orientation="Horizontal">
<Button Content="_" Padding="5,0" VerticalAlignment="Center" HorizontalAlignment="Center" Click="OnMinimizeButtonClick"/>
<Button Content="" Padding="5,0" VerticalAlignment="Center" HorizontalAlignment="Center" Click="OnMaximizeButtonClick"/>
<Button Content="X" Padding="5,0" VerticalAlignment="Center" HorizontalAlignment="Center" Click="OnCloseButtonClick"/>
</StackPanel>

</Grid>


<vw:KreditszenarioView Grid.Row="1"/>
<vw:RatenplanView Grid.Row="2"/>
Expand Down
35 changes: 33 additions & 2 deletions Kreditrechner/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public MainWindow()
DataContext = viewModel;
viewModel.MinimumRepaymentEvent += (sender, eventargs) => ShowMinimumRepaymentView();
}


private void InfoClicked(object sender, RoutedEventArgs e)
{
string messageBoxText = FileVersionInfo.GetVersionInfo(Assembly.GetEntryAssembly().Location).LegalCopyright + "\n" +
"Version: " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
MessageBox.Show(messageBoxText , "Info", MessageBoxButton.OK);
MessageBox.Show(messageBoxText, "Info", MessageBoxButton.OK);
}

private void ShowMinimumRepaymentView()
Expand All @@ -46,5 +46,36 @@ private void ShowMinimumRepaymentView()
win.Owner = this;
win.ShowDialog();
}

private void Menu_MouseDown(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
{
DragMove();
}
}

private void OnCloseButtonClick(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}

private void OnMaximizeButtonClick(object sender, RoutedEventArgs e)
{
if (WindowState == WindowState.Maximized)
{
WindowState = WindowState.Normal;
}

else
{
WindowState = WindowState.Maximized;
}
}

private void OnMinimizeButtonClick(object sender, RoutedEventArgs e)
{
WindowState = WindowState.Minimized;
}
}
}
20 changes: 16 additions & 4 deletions Kreditrechner/View/InstallmentPlanView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,18 @@
xmlns:vc="clr-namespace:Kreditrechner.ValueConverter"
xmlns:loc="clr-namespace:Kreditrechner.Properties"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:InstallmentPlanViewModel, IsDesignTimeCreatable=True}">
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:InstallmentPlanViewModel, IsDesignTimeCreatable=True}"
Background="#181735">

<UserControl.Resources>
<vc:CurrencyConverter x:Key="currencyConverter"/>
<vc:PercentConverter x:Key="percentConverter"/>
<vc:YearConverter x:Key="yearConverter"/>
<vc:DateConverter x:Key="dateConverter"/>
<Style x:Key="CustomDataGridCellStyle" TargetType="DataGridCell">
<Setter Property="TextBlock.FontFamily" Value="Fonts/#Dosis"/>
<Setter Property="TextBlock.FontWeight" Value="Light"/>
</Style>
</UserControl.Resources>

<Grid>
Expand All @@ -23,14 +28,21 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Background="LightGray" Margin="1">
<Label Grid.Row="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Background="Aquamarine" Margin="1">
<TextBlock TextDecorations="Underline" Text="{x:Static loc:Resources.InstallmentPlan}"/>
</Label>

<DataGrid Grid.Row="1" ItemsSource="{Binding InstallmentPlan}" AutoGenerateColumns="False"
IsReadOnly="True" VerticalScrollBarVisibility="Auto" AlternatingRowBackground="AliceBlue"
IsReadOnly="True" VerticalScrollBarVisibility="Auto" RowBackground="#181735" Foreground="White" CellStyle="{StaticResource CustomDataGridCellStyle}"
GridLinesVisibility="None" HeadersVisibility="Column" SelectedItem="{Binding SelectedInstallmentPlanEntry}"
SelectionChanged="RatenplanSelectionChanged">
SelectionChanged="RatenplanSelectionChanged" Background="#181735">
<DataGrid.Resources>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#181735"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Fonts/#Dosis"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static loc:Resources.Number}" Binding="{Binding Month}" Width="auto"/>
<DataGridTextColumn Header="{x:Static loc:Resources.DateInstallmentPlan}" Binding="{Binding Datum, Converter={StaticResource dateConverter}}" Width="*"/>
Expand Down
12 changes: 7 additions & 5 deletions Kreditrechner/View/LoanScenarioView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
xmlns:vc="clr-namespace:Kreditrechner.ValueConverter"
xmlns:loc="clr-namespace:Kreditrechner.Properties"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:LoanScenarioViewModel, IsDesignTimeCreatable=True}">
d:DesignHeight="300" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:LoanScenarioViewModel, IsDesignTimeCreatable=True}"
Background="#181735">

<UserControl.Resources>
<vc:CurrencyConverter x:Key="currencyConverter"/>
Expand All @@ -27,7 +28,8 @@
<RowDefinition/>
</Grid.RowDefinitions>

<Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" FontSize="18" FontWeight="Bold" Background="LightGray" Margin="1">
<Label Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" FontSize="18" FontWeight="Bold" Background="Aquamarine"
Foreground="Black" Margin="1">
<TextBlock TextDecorations="Underline" Text="{x:Static loc:Resources.LoanScenario}"/>
</Label>

Expand Down Expand Up @@ -65,7 +67,7 @@
<TextBlock Text="{x:Static loc:Resources.RateToolTip}"/>
</RadioButton.ToolTip>
</RadioButton>
<TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" MinWidth="120" VerticalAlignment="Center" Text="{Binding Rate, Converter={StaticResource currencyConverter}}" IsReadOnly="{Binding IsTerm}" Background="{Binding BackgroundRate}" GotFocus="TextBox_GotFocus">
<TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" MinWidth="120" VerticalAlignment="Center" Text="{Binding Rate, Converter={StaticResource currencyConverter}}" IsReadOnly="{Binding IsTerm}" GotFocus="TextBox_GotFocus">
<TextBox.ToolTip>
<TextBlock Text="{x:Static loc:Resources.RateResultToolTip}"/>
</TextBox.ToolTip>
Expand All @@ -75,7 +77,7 @@
<TextBlock Text="{x:Static loc:Resources.TermToolTip}"/>
</RadioButton.ToolTip>
</RadioButton>
<TextBox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" MinWidth="120" VerticalAlignment="Center" Text="{Binding Term, Converter={StaticResource yearConverter}}" IsReadOnly="{Binding IsRate}" Background="{Binding BackgroundTerm}" GotFocus="TextBox_GotFocus">
<TextBox Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" MinWidth="120" VerticalAlignment="Center" Text="{Binding Term, Converter={StaticResource yearConverter}}" IsReadOnly="{Binding IsRate}" GotFocus="TextBox_GotFocus">
<TextBox.ToolTip>
<TextBlock Text="{x:Static loc:Resources.TermResultToolTip}"/>
</TextBox.ToolTip>
Expand Down Expand Up @@ -104,7 +106,7 @@
<Label Grid.Row="2" Grid.Column="5" Content="{Binding DifferenceRepaymentAtBegin, Converter={StaticResource diffPercentConverter}}" Foreground="{Binding RepaymentDifferenceColor}"/>
</Grid>

<Button Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="15" Padding="5" Command="{Binding CalculateCommand}" Click="SetButtonFocus" IsDefault="True" Content="{x:Static loc:Resources.Calculate}">
<Button Grid.Row="3" HorizontalAlignment="Center" VerticalAlignment="Center" Template="{StaticResource ButtonTemplate}" Margin="15" Padding="5" Command="{Binding CalculateCommand}" Click="SetButtonFocus" IsDefault="True" Content="{x:Static loc:Resources.Calculate}">
<Button.ToolTip>
<TextBlock Text="{x:Static loc:Resources.CalculateButtonToolTip}"/>
</Button.ToolTip>
Expand Down
5 changes: 3 additions & 2 deletions Kreditrechner/View/MinimumRepaymentView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
xmlns:vc="clr-namespace:Kreditrechner.ValueConverter"
xmlns:loc="clr-namespace:Kreditrechner.Properties"
mc:Ignorable="d"
Title="{x:Static loc:Resources.CalculateMinimumRepaymentToolTip}" Height="250" Width="400" WindowStartupLocation="CenterOwner">
Title="{x:Static loc:Resources.CalculateMinimumRepaymentToolTip}" Height="250" Width="400" WindowStartupLocation="CenterOwner"
Background="#181735">

<Window.DataContext>
<local:MinimumRepaymentViewModel/>
Expand Down Expand Up @@ -54,7 +55,7 @@
</TextBox.ToolTip>
</TextBox>

<Button Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5" Click="SetButtonFocus" IsDefault="True" Command="{Binding CalculateCommand}" Content="{x:Static loc:Resources.Calculate}">
<Button Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Template="{StaticResource ButtonTemplate}" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="5" Click="SetButtonFocus" IsDefault="True" Command="{Binding CalculateCommand}" Content="{x:Static loc:Resources.Calculate}">
<Button.ToolTip>
<TextBlock Text="{x:Static loc:Resources.CalculateMinimumRepaymentToolTip}"/>
</Button.ToolTip>
Expand Down
16 changes: 12 additions & 4 deletions Kreditrechner/View/UnscheduledPaymentPlanView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
xmlns:vc="clr-namespace:Kreditrechner.ValueConverter"
xmlns:loc="clr-namespace:Kreditrechner.Properties"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:UnscheduledPaymentPlanViewModel, IsDesignTimeCreatable=True}">
d:DesignHeight="450" d:DesignWidth="800" d:DataContext="{d:DesignInstance vm:UnscheduledPaymentPlanViewModel, IsDesignTimeCreatable=True}"
Background="#181735">

<UserControl.Resources>
<vc:CurrencyConverter x:Key="currencyConverter"/>
Expand All @@ -23,14 +24,21 @@
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Label Grid.Row="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Background="LightGray" Margin="1">
<Label Grid.Row="0" HorizontalAlignment="Stretch" HorizontalContentAlignment="Center" Background="Aquamarine" Foreground="Black" Margin="1">
<TextBlock TextDecorations="Underline" Text="{x:Static loc:Resources.UnscheduledPaymentPlan}"/>
</Label>

<DataGrid Grid.Row="1" ItemsSource="{Binding UnscheduledPayments}" AutoGenerateColumns="False" AlternatingRowBackground="AliceBlue"
IsReadOnly="True" GridLinesVisibility="None" HeadersVisibility="Column" SelectedItem="{Binding SelectedUnscheduledPayment}">
IsReadOnly="True" GridLinesVisibility="None" HeadersVisibility="Column" SelectedItem="{Binding SelectedUnscheduledPayment}" Background="#181735">
<DataGrid.Resources>
<Style TargetType="DataGridColumnHeader">
<Setter Property="Background" Value="#181735"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Fonts/#Dosis"/>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTextColumn Header="{x:Static loc:Resources.MonthUnscheduledRepaymentPlan}" Binding="{Binding Month}" Width="auto"/>
<DataGridTextColumn Header="{x:Static loc:Resources.MonthUnscheduledRepaymentPlan}" Binding="{Binding Month}" Width="auto" MinWidth="80"/>
<DataGridTextColumn Header="{x:Static loc:Resources.AmountUnscheduledRepaymentPlan}" Binding="{Binding Amount, Converter={StaticResource currencyConverter}}" Width="*"/>
</DataGrid.Columns>
</DataGrid>
Expand Down
Loading

0 comments on commit a73bd02

Please sign in to comment.