Files
BeWoPlaner/BeWo/View/NotizenView.xaml
Christian c92c9396b5 cb
2019-12-09 11:38:52 +01:00

271 lines
22 KiB
XML

<view:BeWoView x:Class="BeWo.View.NotizenView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:view="clr-namespace:BeWo.View"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:validation="clr-namespace:BeWo.Validation"
xmlns:core="clr-namespace:BS.Shared.Core;assembly=BS.Shared"
xmlns:controls="clr-namespace:BeWo.View.Controls"
xmlns:markup="clr-namespace:BeWo.MultiLanguage.Markup"
xmlns:controls1="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
mc:Ignorable="d" VerticalAlignment="Stretch" Focusable="True">
<view:BeWoView.Resources>
<Style x:Key="NotizenListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Background" Value="#00FFFFFF" />
<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}" />
<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ItemsControl}}}" />
<Setter Property="Padding" Value="2,0,0,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="Bd" SnapsToDevicePixels="True" Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Content="{TemplateBinding Content}"
ContentStringFormat="{TemplateBinding ContentStringFormat}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="HyperlinkStyle" TargetType="{x:Type Hyperlink}">
<Setter Property="Foreground" Value="#FF2B508B" />
<!--<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#FFAFAFAF" />
</Trigger>
</Style.Triggers>-->
</Style>
</view:BeWoView.Resources>
<GroupBox Header="{markup:Translate NotizenHeader}" Style="{StaticResource ObjectEditGroupBox}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<Button Content="Neue Kategorie hinzufügen" Margin="3" Click="ButtonOpenAddNotizenKategorieClick" IsEnabled="{Binding Path=DarfNotizenEintragAnlegen, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" />
<controls:PopupNonTopmost x:Name="popup_newNotizenKategorie">
<Border Background="White" Padding="3" BorderThickness="1" BorderBrush="Gray">
<GroupBox x:Name="groupbox_newNotizenKategorie" Header="Neue Kategorie hinzufügen" Style="{DynamicResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Name" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Height="23" Margin="3,0,3,3" Text="{validation:ValidationBinding Path=NewVM.KategorieName}" />
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Click="ButtonAddNotizenKategorieClick" Content="Hinzufügen" Height="25"
FontWeight="Normal" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" />
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Height="25"
Margin="3" Content="Abbrechen" Click="ButtonCancelAddNotizenKategorieClick" />
</StackPanel>
</Grid>
</GroupBox>
</Border>
</controls:PopupNonTopmost>
<controls:PopupNonTopmost x:Name="popup_newNotizenEintrag" Placement="MousePoint">
<Border Background="White" Padding="3" BorderThickness="1" BorderBrush="Gray">
<GroupBox x:Name="groupbox_newNotizenEintrag" Header="Neue Notiz hinzufügen" Style="{DynamicResource ObjectEditGroupBox}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!-- RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}} -->
<!--<Label Grid.Column="0" Grid.Row="0" Content="Kasse" VerticalAlignment="Center" />
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Height="23" Margin="3,0,3,3" ItemsSource="{Binding VMList}" Width="150" x:Name="NewTransaktionKassenCB"
EditValue="{validation:ValidationBinding Path=SelectedNotizenKategorie, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" />-->
<Label Grid.Column="0" Grid.Row="0" Content="Datum" VerticalAlignment="Center" />
<dxe:DateEdit Grid.Column="1" Grid.Row="0" MaskType="DateTimeAdvancingCaret" Width="100" AllowNullInput="False"
EditValue="{validation:ValidationBinding Path=NewNotizenEintrag.Datum, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" Height="23" Margin="3" x:Name="NewTransaktionDatumDateEdit" HorizontalAlignment="Left"/>
<Label Grid.Column="0" Grid.Row="2" Content="Notiz" VerticalAlignment="Center" />
<Label Grid.Column="0" Grid.Row="1" Content="Kategorie" VerticalAlignment="Center" />
<controls1:NullItemComboBox Grid.Column="1" Grid.Row="1" ItemsSource="{Binding Path=EintragKategorien}" Margin="3" SelectedValue="{Binding Path=NewNotizenEintrag.EintragKategorieDC, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}"/>
<TextBox Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" VerticalAlignment="Center" Width="400" Height="200" Margin="3,0,3,3"
ScrollViewer.CanContentScroll="False" VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Hidden" TextWrapping="Wrap" AcceptsReturn="True"
AutoWordSelection="True" Language="de-DE" SpellCheck.IsEnabled="True"
x:Name="NewEintragNotizTextBox"
Text="{Binding Path=NewNotizenEintrag.Notice, UpdateSourceTrigger=PropertyChanged, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}"/>
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Right">
<Button Click="ButtonAddNotizenEintragClick" Content="Hinzufügen" Height="25"
FontWeight="Normal" Margin="3" VerticalAlignment="Center" HorizontalAlignment="Right" />
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Height="25"
Margin="3" Content="Abbrechen" Click="ButtonCancelAddNotizenEintragClick" />
</StackPanel>
</Grid>
</GroupBox>
</Border>
</controls:PopupNonTopmost>
</StackPanel>
<TabControl Grid.Row="1" Margin="5" ItemsSource="{Binding VMList}" x:Name="tabcontrol_NotizenKategorien" Visibility="{Binding VMList.Count, Converter={StaticResource CollectionCountToVisibilityConverter}}">
<TabControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Label Content="{Binding KategorieName}" />
<Button VerticalAlignment="Center" Height="20"
ToolTip="Kategorie umbenennen"
Margin="3" Content="!" FontFamily="Wingdings"
IsEnabled="{Binding Path=DarfNotizenEintraegeBearbeiten, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}"
Click="KategorienamenChangeButtonClick">
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type TabItem}}" />
</MultiBinding>
</Button.Visibility>
</Button>
<controls:PopupNonTopmost x:Name="popup_KategorienamenEdit">
<Border Background="White" Padding="3" BorderThickness="1" BorderBrush="Gray">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<TextBox Width="200" Grid.Row="0" Grid.Column="0" Height="23" Margin="3" Text="{validation:ValidationBinding Path=KategorieName, UpdateSourceTrigger=PropertyChanged}" />
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
<Button Content="Speichern" Margin="3" Click="KategorienamenChangeSaveButtonClick" />
<Button Content="Abbrechen" Margin="3" Click="KategorienamenChangeCancelButtonClick" />
</StackPanel>
</Grid>
</Border>
</controls:PopupNonTopmost>
<Button VerticalAlignment="Center" Height="20"
Click="BtnDeleteNotizenKategorieClick"
Tag="{Binding}"
ToolTip="Kategorie entfernen"
Style="{DynamicResource CloseButtonStyle}" Margin="3" >
<Button.Visibility>
<MultiBinding Converter="{StaticResource BoolVisibilityMultiConverter }">
<Binding Path="IsSelected" RelativeSource="{RelativeSource AncestorType={x:Type TabItem}}" />
<Binding Path="DarfNotizenEintragLoeschen" RelativeSource="{RelativeSource AncestorType={x:Type view:NotizenView}}" />
</MultiBinding>
</Button.Visibility>
</Button>
</StackPanel>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<Grid Tag="{Binding}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Grid.Row="1" Orientation="Horizontal" Grid.ColumnSpan="4">
<Button Content="Neue Notiz hinzufügen" Margin="3" Tag="{Binding}" Click="ButtonOpenAddNotizenEintragClick" IsEnabled="{Binding Path=DarfNotizenEintragAnlegen, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" />
<!--<Label VerticalAlignment="Center">Auszahlungsintervall</Label>
<dxe:ComboBoxEdit VerticalAlignment="Center" Height="23" HorizontalAlignment="Left" Width="100" IsTextEditable="False" Margin="3,0,3,3"
ItemsSource="{Binding Path=Values, Source={x:Static core:DisplayEnum.Auszahlungsintervall}}"
EditValue="{Binding Path=Auszahlungsintervall, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=DarfNotizenEintraegeBearbeiten, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}"
EditValueChanged="AuszahlungsIntervallCBEditValueChanged"/>-->
<Label Content="Startdatum" VerticalAlignment="Center"/>
<dxe:DateEdit x:Name="KategorieStartCB" MaskType="DateTimeAdvancingCaret" Height="23" Margin="3" EditValue="{Binding Path=PreselectedStartDate, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}, Mode=OneWay}" AllowNullInput="False" />
<Label Content="Enddatum" VerticalAlignment="Center"/>
<dxe:DateEdit x:Name="KategorieEndCB" MaskType="DateTimeAdvancingCaret" Height="23" Margin="3" EditValue="{Binding Path=PreselectedEndDate, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}, Mode=OneWay}" AllowNullInput="False"/>
<!--<uc:NullItemComboBox x:Name="KassenbuchMonatsCB" Margin="3" ItemsSource="{Binding Path=MonatsComboBoxSource, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenKategorienView}}}"
SelectedItem="{Binding Path=PreselectedMonth, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenKategorienView}}, Mode=OneWay}"/>
<uc:NullItemComboBox x:Name="KassenbuchJahresCB" Margin="3" ItemsSource="{Binding Path=JahresComboBoxSource, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenKategorienView}}}"
SelectedItem="{Binding Path=PreselectedYear, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenKategorienView}}, Mode=OneWay}"/>-->
<TextBlock Margin="3" FontSize="14" VerticalAlignment="Center" PreviewMouseLeftButtonDown="KategorieLinkOnPreviewMouseLeftButtonDown" Tag="{Binding}" IsEnabled="{Binding Path=NotizenEintraege.VMList.Count, Converter={StaticResource CollectionCountToBoolConverter}, UpdateSourceTrigger=PropertyChanged}">
<Hyperlink x:Name="LinkKategorieDrucken" TargetName="_NewWindow" Style="{StaticResource HyperlinkStyle}">
<Run Text="Drucken" />
</Hyperlink>
</TextBlock>
</StackPanel>
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="4" x:Name="EintraegeGrid" Style="{StaticResource ObjectEditGroupBox}" Header="Notizen">
<dxg:GridControl Name="grid_NotizenEintraege" Tag="{Binding}" MaxWidth="{Binding ElementName=EintraegeGrid, Path=ActualWidth}" ItemsSource="{Binding Path=NotizenEintraege.VMList}" CustomColumnSort="GridNotizenEintraegeOnCustomColumnSort">
<dxg:GridControl.Columns>
<dxg:GridColumn Header="" FixedWidth="True" Width="24" ReadOnly="True" Visible="{Binding Path=DarfNotizenEintraegeBearbeiten, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<Button Content="r" Tag="{Binding}" Click="ButtonNotizenEintragDeleteClick" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center" IsEnabled="{Binding Path=DarfNotizenEintragLoeschen, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" />
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
<dxg:GridColumn Header="Datum" FixedWidth="True" SortOrder="Descending" FieldName="Datum" EditSettings="{dxe:DateSettings DisplayFormat=d}" AllowEditing="{Binding Path=NotizenEintraegeBearbeitenAlsDefaultBooelan, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}" />
<dxg:GridColumn Header="Angelegt am" FixedWidth="True" FieldName="InsTs" AllowEditing="False"/>
<dxg:GridColumn Header="Angelegt von" FixedWidth="True" FieldName="InsUser" AllowEditing="False"/>
<dxg:GridColumn Binding="{Binding Path=RowData.Row.EintragKategorieDC, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Header="Kategorie" FixedWidth="True" >
<dxg:GridColumn.EditSettings >
<dxe:ComboBoxEditSettings ItemsSource="{Binding Path=EintragKategorienMitLeereintrag, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}, Mode=FindAncestor}}" IsTextEditable="False"/>
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
<dxg:GridColumn Header="Notiz" FieldName="Notice" AllowEditing="{Binding Path=NotizenEintraegeBearbeitenAlsDefaultBooelan, RelativeSource={RelativeSource AncestorType={x:Type view:NotizenView}}}">
<dxg:GridColumn.EditSettings>
<dxe:MemoEditSettings TextWrapping="NoWrap" AcceptsReturn="True" MemoTextWrapping="NoWrap" MemoAcceptsReturn="True" ShowIcon="False" />
</dxg:GridColumn.EditSettings>
</dxg:GridColumn>
</dxg:GridControl.Columns>
<dxg:GridControl.View>
<dxg:TableView NavigationStyle="Cell" Margin="2,2,2,2" AutoWidth="True" ShowGroupPanel="False" ShowGroupedColumns="False" ShowTotalSummary="False" />
</dxg:GridControl.View>
</dxg:GridControl>
</GroupBox>
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
</Grid>
</GroupBox>
</view:BeWoView>