Initial Commit
This commit is contained in:
49
View/Dialogs/AddTransactionView.xaml
Normal file
49
View/Dialogs/AddTransactionView.xaml
Normal file
@@ -0,0 +1,49 @@
|
||||
<Window x:Class="DebtMgr.View.Dialogs.AddTransactionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:c="clr-namespace:CurrencyTextBoxControl;assembly=CurrencyTextBoxControl"
|
||||
mc:Ignorable="d"
|
||||
Icon="../../Content/moneybag.ico"
|
||||
Name="AddTransactionViewWindow"
|
||||
Title="{Binding WindowTitle}" Height="300" Width="300"
|
||||
KeyUp="Window_OnKeyUp">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Vertical">
|
||||
<Label Content="{Binding ElementName=AddTransactionViewWindow, Path=Title}" FontWeight="Bold" FontSize="18"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="10 0">
|
||||
<c:CurrencyTextBox KeyUp="TextBox_OnKeyUp" Name="Amount" Number="{Binding AmountTextBoxText}" StringFormat="0.00 Eur" FontSize="16" Margin="0 0 0 -5"></c:CurrencyTextBox>
|
||||
<Label Content="Amount in EUR"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Vertical" Margin="10 0">
|
||||
<TextBox KeyUp="TextBox_OnKeyUp" Name="Description" Text="{Binding DescriptionTextBoxText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 -5"></TextBox>
|
||||
<Label Content="Description"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="3" Orientation="Vertical" Margin="10 0">
|
||||
<DatePicker KeyUp="TextBox_OnKeyUp" SelectedDate="{Binding DatePickerSelectedDate}"></DatePicker>
|
||||
<Label Content="Date"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="4" Orientation="Vertical" Margin="10 0">
|
||||
<ComboBox KeyUp="TextBox_OnKeyUp" Name="PersonComboBox" ItemsSource="{Binding PersonComboBoxItemSource}" SelectedItem="{Binding PersonComboBoxSelectedItem}">
|
||||
</ComboBox>
|
||||
<Label Content="Person"></Label>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="1" Content="Add Deposit" FontSize="14" Padding="5" Margin="10 -10" Command="{Binding AddTransactionButtonClickCommand}"></Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
58
View/Dialogs/AddTransactionView.xaml.cs
Normal file
58
View/Dialogs/AddTransactionView.xaml.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using DebtMgr.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using DebtMgr.Model;
|
||||
|
||||
namespace DebtMgr.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für AddTransactionView.xaml
|
||||
/// </summary>
|
||||
public partial class AddTransactionView : Window
|
||||
{
|
||||
public AddTransactionView(TransactionType transactionType, Person preselectedPerson)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.CenterOnParent();
|
||||
|
||||
App.Locator.AddTransactionView.ClearView();
|
||||
|
||||
App.Locator.AddTransactionView.DialogMode = transactionType;
|
||||
App.Locator.AddTransactionView.PreselectedPerson = preselectedPerson;
|
||||
App.Locator.AddTransactionView.SetModeSpecificStrings();
|
||||
|
||||
App.Locator.AddTransactionView.RequestClose += (s, e) => Close();
|
||||
|
||||
DataContext = App.Locator.AddTransactionView;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by TextBox for on key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 09.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void TextBox_OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Enter) || e.Key.Equals(Key.Return))
|
||||
App.Locator.AddTransactionView.AddTransactionButtonClickCommand.Execute(null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by Window for on key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 09.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void Window_OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Escape))
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
30
View/Dialogs/DatabaseSelectorDialogView.xaml
Normal file
30
View/Dialogs/DatabaseSelectorDialogView.xaml
Normal file
@@ -0,0 +1,30 @@
|
||||
<Window x:Class="DebtMgr.View.Dialogs.DatabaseSelectorDialogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d"
|
||||
Title="Debt Manager - Select Database" Height="250" Width="400"
|
||||
KeyUp="Window_OnKeyUp">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="3*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="1*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Content="Select existing Database" FontWeight="Bold" FontSize="18" Margin="0 20 0 0"></Label>
|
||||
<TextBox Grid.Row="1" Grid.Column="0" FontSize="14" Margin="5 5 0 5" IsEnabled="False" Text="{Binding SelectDatabasePathText}"></TextBox>
|
||||
<Button Grid.Row="1" Grid.Column="1" FontSize="14" Content="Browse" Margin="5" Command="{Binding SelectDatabaseButtonClick}"></Button>
|
||||
<Separator Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="0 20"></Separator>
|
||||
<Label Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Content="Create new Database" FontWeight="Bold" FontSize="18"></Label>
|
||||
<TextBox Grid.Row="4" Grid.Column="0" FontSize="14" Margin="5 5 0 5" IsEnabled="False"></TextBox>
|
||||
<Button Grid.Row="4" Grid.Column="1" FontSize="14" Content="Create" Margin="5" Command="{Binding CreateDatabaseButtonClick}"></Button>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
40
View/Dialogs/DatabaseSelectorDialogView.xaml.cs
Normal file
40
View/Dialogs/DatabaseSelectorDialogView.xaml.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using DebtMgr.Extensions;
|
||||
|
||||
namespace DebtMgr.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für DatabaseSelectorDialogView.xaml
|
||||
/// </summary>
|
||||
public partial class DatabaseSelectorDialogView : Window
|
||||
{
|
||||
public DatabaseSelectorDialogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.CenterOnParent();
|
||||
|
||||
App.Locator.DatabaseSelectorDialogView.RequestClose += (s, e) => Close();
|
||||
DataContext = App.Locator.DatabaseSelectorDialogView;
|
||||
}
|
||||
|
||||
private void Window_OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Escape))
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
View/Dialogs/NewPersonDialogView.xaml
Normal file
36
View/Dialogs/NewPersonDialogView.xaml
Normal file
@@ -0,0 +1,36 @@
|
||||
<Window x:Class="DebtMgr.View.Dialogs.NewPersonDialogView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DebtMgr.View.Dialogs"
|
||||
mc:Ignorable="d"
|
||||
Name="NewPersonDialogViewWindow"
|
||||
Icon="../../Content/addperson.ico"
|
||||
Title="New Person" Height="205" Width="300"
|
||||
KeyUp="Window_KeyUp">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="New Person" FontWeight="Bold" FontSize="18"></Label>
|
||||
<StackPanel Grid.Row="1" Orientation="Vertical" Margin="10 0">
|
||||
<TextBox KeyUp="TextBox_OnKeyUp" Name="FirstNameTextBox" Text="{Binding FirstNameTextBoxText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 -5"></TextBox>
|
||||
<Label Content="First name"></Label>
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="2" Orientation="Vertical" Margin="10 5">
|
||||
<TextBox KeyUp="TextBox_OnKeyUp" Text="{Binding LastNameTextBoxText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="16" Margin="0 0 0 -5"></TextBox>
|
||||
<Label Content="Last name"></Label>
|
||||
</StackPanel>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Grid.Column="1" Content="Create Person" FontSize="14" Padding="5" Margin="10 -10" Command="{Binding CreatePersonButtonClickCommand}"></Button>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
51
View/Dialogs/NewPersonDialogView.xaml.cs
Normal file
51
View/Dialogs/NewPersonDialogView.xaml.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using DebtMgr.Extensions;
|
||||
|
||||
namespace DebtMgr.View.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für NewPersonDialogView.xaml
|
||||
/// </summary>
|
||||
public partial class NewPersonDialogView : Window
|
||||
{
|
||||
public NewPersonDialogView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.CenterOnParent();
|
||||
|
||||
App.Locator.NewPersonDialogView.RequestClose += (s, e) => Close();
|
||||
DataContext = App.Locator.NewPersonDialogView;
|
||||
|
||||
FirstNameTextBox.Focus();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by TextBox for on key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 09.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void TextBox_OnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Enter) || e.Key.Equals(Key.Return))
|
||||
App.Locator.NewPersonDialogView.CreatePersonButtonClickCommand.Execute(null);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Event handler. Called by Window for key up events. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 09.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void Window_KeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key.Equals(Key.Escape))
|
||||
Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
137
View/MainView.xaml
Normal file
137
View/MainView.xaml
Normal file
@@ -0,0 +1,137 @@
|
||||
<Window x:Class="DebtMgr.View.MainView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="clr-namespace:DebtMgr.Converters"
|
||||
mc:Ignorable="d"
|
||||
Icon="../Content/icon.ico"
|
||||
Title="Debt Manager" Height="600" Width="900">
|
||||
<Window.Resources>
|
||||
<converters:AmountToColorConverter x:Key="AmountToColorConverter" />
|
||||
<Style TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
</Style>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- #region Menu -->
|
||||
|
||||
<DockPanel Grid.Row="0">
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="Person">
|
||||
<MenuItem Header="_New" Command="{Binding MenuNewPersonCommand}" />
|
||||
<MenuItem Header="_Manage" IsEnabled="False" />
|
||||
<Separator />
|
||||
<MenuItem Header="_Exit" Command="{Binding MenuExitCommand}" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</DockPanel>
|
||||
|
||||
<!-- #endregion -->
|
||||
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"></ColumnDefinition>
|
||||
<ColumnDefinition Width="3*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<!-- #region PersonListView -->
|
||||
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Content="Overview" FontWeight="Bold" FontSize="22" Margin="0 0 0 -5"></Label>
|
||||
<TextBlock Grid.Row="1" FontSize="18" Margin="5 0 0 5">
|
||||
<TextBlock Text="Overall Balance:"></TextBlock>
|
||||
<TextBlock Text="{Binding OverallBalanceLabel}" Foreground="{Binding OverallBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
|
||||
<TextBlock Text="€" Foreground="{Binding OverallBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
|
||||
</TextBlock>
|
||||
<ListView Name="PersonListView" Grid.Row="2" ItemsSource="{Binding PersonListViewItemSource}" SelectedItem="{Binding PersonListViewSelectedItem}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding FirstName}" Width="100">
|
||||
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="FirstName">First name</GridViewColumnHeader>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding LastName}" Width="100">
|
||||
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="LastName">Last name</GridViewColumnHeader>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="80">
|
||||
<GridViewColumnHeader Command="{Binding SortPersonListViewCommand}" CommandParameter="Total">Balance</GridViewColumnHeader>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock TextAlignment="Right" Foreground="{Binding Total, Converter={StaticResource AmountToColorConverter}}" Text="{Binding Total, StringFormat='{}{0:N} €'}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="PersonListViewContextMenu">
|
||||
<MenuItem Header="Add charge" Command="{Binding AddChargeContextMenuCommand}" />
|
||||
<MenuItem Header="Add deposit" Command="{Binding AddDepositContextMenuCommand}" />
|
||||
<MenuItem Header="New Person" Command="{Binding NewPersonContextMenuCommand}" />
|
||||
<MenuItem Header="Delete Person" Command="{Binding DeletePersonContextMenuCommand}" CommandParameter="{Binding Path=SelectedItem}" />
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ContextMenu>
|
||||
<StaticResource ResourceKey="PersonListViewContextMenu" />
|
||||
</ListBox.ContextMenu>
|
||||
</ListView>
|
||||
</Grid>
|
||||
|
||||
<!-- #endregion -->
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="Auto"></RowDefinition>
|
||||
<RowDefinition Height="*"></RowDefinition>
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"></ColumnDefinition>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Label Grid.Row="0" Content="{Binding DetailViewHeaderLabelContent}" FontWeight="Bold" FontSize="22" Margin="0 0 0 -5"></Label>
|
||||
<TextBlock Grid.Row="1" FontSize="18" Margin="5 0 0 5">
|
||||
<TextBlock Text="Balance:"></TextBlock>
|
||||
<TextBlock Text="{Binding DetailViewBalanceLabel}" Foreground="{Binding DetailViewBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
|
||||
<TextBlock Text="€" Foreground="{Binding DetailViewBalanceLabel, Converter={StaticResource AmountToColorConverter}}"></TextBlock>
|
||||
</TextBlock>
|
||||
<ListView Name="TransactionHistoryListView" Grid.Row="2" ItemsSource="{Binding TransactionHistoryListViewItemSource}" SelectedItem="{Binding TransactionHistoryListViewSelectedItem}" HorizontalContentAlignment="Stretch">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridView.ColumnHeaderContainerStyle>
|
||||
<Style TargetType="{x:Type GridViewColumnHeader}">
|
||||
<Setter Property="IsEnabled" Value="False"/>
|
||||
</Style>
|
||||
</GridView.ColumnHeaderContainerStyle>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding Time, StringFormat='{}{0:MMM. yyyy}'}" Width="80" Header="Date" />
|
||||
<GridViewColumn Width="80" Header="Amount">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock TextAlignment="Right" Foreground="{Binding SignedAmount, Converter={StaticResource AmountToColorConverter}}" Text="{Binding SignedAmount, StringFormat='{}{0:N} €'}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding Description}" Width="Auto" Header="Description" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListBox.Resources>
|
||||
<ContextMenu x:Key="TransactionHistoryListViewContextMenu">
|
||||
<MenuItem Header="Add charge" Command="{Binding AddChargeContextMenuCommand}" />
|
||||
<MenuItem Header="Add deposit" Command="{Binding AddDepositContextMenuCommand}" />
|
||||
<MenuItem Header="Delete Transaction" Command="{Binding DeleteTransactionContextMenuCommand}" CommandParameter="{Binding Path=SelectedItem}" />
|
||||
</ContextMenu>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ContextMenu>
|
||||
<StaticResource ResourceKey="TransactionHistoryListViewContextMenu" />
|
||||
</ListBox.ContextMenu>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
68
View/MainView.xaml.cs
Normal file
68
View/MainView.xaml.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DebtMgr.View
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für MainView.xaml
|
||||
/// </summary>
|
||||
public partial class MainView : Window
|
||||
{
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Default constructor. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 10.09.2017. </remarks>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
public MainView()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = App.Locator.MainView;
|
||||
|
||||
PersonListView.KeyUp += PersonListViewOnKeyUp;
|
||||
TransactionHistoryListView.KeyUp += TransactionHistoryListViewOnKeyUp;
|
||||
}
|
||||
|
||||
#region PersonListViewOnKeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Person list view on key up. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 10.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void PersonListViewOnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
if (App.Locator.MainView.DeletePersonContextMenuCommand.CanExecute(null))
|
||||
App.Locator.MainView.DeletePersonContextMenuCommand.Execute(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region TransactionHistoryListViewOnKeyUp()
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// <summary> Transaction history list view on key up. </summary>
|
||||
///
|
||||
/// <remarks> Andre Beging, 10.09.2017. </remarks>
|
||||
///
|
||||
/// <param name="sender"> Source of the event. </param>
|
||||
/// <param name="e"> Key event information. </param>
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
private void TransactionHistoryListViewOnKeyUp(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Delete)
|
||||
{
|
||||
if (App.Locator.MainView.DeleteTransactionContextMenuCommand.CanExecute(null))
|
||||
App.Locator.MainView.DeleteTransactionContextMenuCommand.Execute(null);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user