Tätigkeitedit erweitert
This commit is contained in:
@@ -6,26 +6,53 @@
|
||||
xmlns:local="clr-namespace:KanSan.UI"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.CommandBindings>
|
||||
<CommandBinding Command="local:CalendarCommands.SelectToday"
|
||||
Executed="SelectTodayExecuted"
|
||||
CanExecute="SelectTodayCanExecute" />
|
||||
</UserControl.CommandBindings>
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="DefaultCalendar" TargetType="Calendar">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Calendar}">
|
||||
<StackPanel HorizontalAlignment="Center" Name="PART_Root">
|
||||
<CalendarItem Background="{TemplateBinding Control.Background}" BorderBrush="{TemplateBinding Control.BorderBrush}" BorderThickness="{TemplateBinding Control.BorderThickness}" Name="PART_CalendarItem" Style="{TemplateBinding Calendar.CalendarItemStyle}" />
|
||||
<Button Content="Today" Command="local:CalendarCommands.SelectToday" CommandParameter="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
|
||||
<RowDefinition Height="39" />
|
||||
<RowDefinition Height="39" />
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition Height="39" />
|
||||
<RowDefinition Height="39" />
|
||||
<RowDefinition Height="39" />
|
||||
<RowDefinition Height="39" />
|
||||
|
||||
</Grid.RowDefinitions>
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Mitarbeiter" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Fahrzeug" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Datum" />
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" Content="Tätigkeitbeschreibung" />
|
||||
<Label Grid.Row="4" Grid.Column="0" Content="Menge" />
|
||||
<Label Grid.Row="5" Grid.Column="0" Content="Bemerkung" />
|
||||
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Mitarbeiter}" />
|
||||
|
||||
<Calendar Style="{StaticResource DefaultCalendar}" Grid.Row="2" Grid.Column="1" SelectedDate="{Binding ZeitStempel}"/>
|
||||
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Text="{Binding Menge}" />
|
||||
<TextBox Grid.Row="5" Grid.Column="1" Text="{Binding Bemerkung}"/>
|
||||
<Button Grid.Row="6" Grid.ColumnSpan="2" Content="Speichern" Name="Speichern" Click="Speichern_Click" />
|
||||
|
||||
</Grid>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using KanSan.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@@ -15,6 +16,10 @@ using System.Windows.Shapes;
|
||||
|
||||
namespace KanSan.UI
|
||||
{
|
||||
public static class CalendarCommands
|
||||
{
|
||||
public static RoutedCommand SelectToday = new RoutedCommand("Today", typeof(CalendarCommands));
|
||||
}
|
||||
/// <summary>
|
||||
/// Interaktionslogik für UCTaetigkeitEdit.xaml
|
||||
/// </summary>
|
||||
@@ -39,5 +44,22 @@ namespace KanSan.UI
|
||||
(DataContext as TaetigkeitEditViewModel).Speichern();
|
||||
OnSpeichernClicked(EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void SelectTodayExecuted(object target, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
var calendar = target as Calendar;
|
||||
if(calendar == null)
|
||||
{
|
||||
if (Debugger.IsAttached)
|
||||
Debugger.Break();
|
||||
return;
|
||||
}
|
||||
Debugger.Break();
|
||||
}
|
||||
|
||||
private void SelectTodayCanExecute(object target, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
e.CanExecute = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user