Files
BeWoPlaner/BeWo/View/Detail/TextModuleView.xaml

179 lines
13 KiB
XML

<view:BeWoView x:Class="BeWo.View.Detail.TextModuleView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:view="clr-namespace:BeWo.View"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:validation="clr-namespace:BeWo.Validation"
xmlns:detail="clr-namespace:BeWo.View.Detail"
xmlns:controls="clr-namespace:BeWo.Controls;assembly=BeWo.Controls"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
Height="Auto" Width="Auto" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Focusable="True">
<view:BeWoView.Resources>
<detail:IsOnlyForEmployeeRightsConverter x:Key="IsOnlyForEmployeeRightsConverter" />
<detail:TextModuleEditConverter x:Key="TextModuleEditConverter" />
</view:BeWoView.Resources>
<GroupBox Name="root" Style="{StaticResource ObjectEditGroupBox}">
<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Column="0" Grid.Row="0" IsEnabled="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=detail:TextModuleView}, Path=AreUserControlsEnabled}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Name" />
<TextBox xml:space="preserve" Grid.Column="1" Grid.Row="0" MinWidth="125" Text="{validation:ValidationBinding Path=NewVM.Name, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}" />
<Label Grid.Column="2" Grid.Row="0" Content="Position" />
<dxe:SpinEdit Grid.Column="3" Grid.Row="0" Width="100" Height="23" MinValue="0" IsFloatValue="False"
Value="{Binding Path=NewVM.Position, Mode=TwoWay, Converter={StaticResource Int2DecimalConverter}, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=NewVM.IsParent, Converter={StaticResource BoolReverseConverter}, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Column="4" Grid.Row="0" Content="Leistungskategorie" />
<controls:NullItemComboBox Grid.Column="5" Grid.Row="0" Width="150" Height="23" ItemsSource="{Binding Path=PossibleCategories, Mode=OneWay}" SelectedItem="{Binding Path=NewVM.ServiceCategory}"
IsEnabled="{Binding Path=NewVM.IsParent, Converter={StaticResource BoolReverseConverter}, UpdateSourceTrigger=PropertyChanged}" />
<Label Grid.Column="6" Grid.Row="0" Content="Textbausteinkategorie" />
<controls:NullItemComboBox Grid.Column="7" Grid.Row="0" Width="150" x:Name="Box" Height="23" ItemsSource="{Binding Path=PossibleTextModuleParents, Mode=OneWay, UpdateSourceTrigger=Explicit}" SelectedItem="{Binding Path=NewVM.Parent}" />
<CheckBox Grid.Column="1" Grid.Row="2" Content="Als Textbausteinkategorie speichern" Margin="0,3,3,0"
IsChecked="{Binding Path=NewVM.IsParent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.ColumnSpan="3" Checked="SaveAsTextModuleCategory_OnChecked" />
<Label Grid.Column="0" Grid.Row="3" Content="Text" />
<TextBox Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="7" AcceptsReturn="True" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Height="100" Margin="0,3,0,0"
xml:space="preserve" Text="{Binding Path=NewVM.Text, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=NewVM.IsParent, Converter={StaticResource BoolReverseConverter}, UpdateSourceTrigger=PropertyChanged}" />
<Button Grid.Column="4" Grid.Row="4" x:Name="AddTextModuleButton" Margin="0,3,0,0" HorizontalAlignment="Right" Grid.ColumnSpan="4" Click="ButtonAddTextModule_Click" Content="Hinzufügen" />
</Grid>
<dxg:TreeListControl Name="TreeListControl" Grid.Column="0" Grid.Row="1" ItemsSource="{Binding Path=VMList}" Margin="0,15,0,0">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="IsDeleteable" Header="" FixedWidth="True" Width="24" ReadOnly="True">
<dxg:TreeListColumn.CellTemplate>
<DataTemplate>
<Button Content="r" Click="DeleteButton_Click" FontFamily="Webdings" Width="18" Height="18" VerticalAlignment="Center">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource TextModuleEditConverter}">
<Binding />
<Binding Path="DataContext.RowData.Row" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</Button.IsEnabled>
</Button>
</DataTemplate>
</dxg:TreeListColumn.CellTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Name">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:TextEdit EditMode="InplaceInactive" FontWeight="{Binding Path=DataContext.RowData.Row.FontWeight, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding Path=DataContext.RowData.Row.Name, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}">
<dxe:TextEdit.IsEnabled>
<MultiBinding Converter="{StaticResource TextModuleEditConverter}">
<Binding />
<Binding Path="DataContext.RowData.Row" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</dxe:TextEdit.IsEnabled>
</dxe:TextEdit>
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<dxe:TextEdit x:Name="PART_Editor" EditMode="InplaceActive" FontWeight="{Binding Path=DataContext.RowData.Row.FontWeight, RelativeSource={RelativeSource TemplatedParent}}" Text="{Binding Path=DataContext.RowData.Row.Name, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}">
<dxe:TextEdit.IsEnabled>
<MultiBinding Converter="{StaticResource TextModuleEditConverter}">
<Binding />
<Binding Path="DataContext.RowData.Row" RelativeSource="{RelativeSource TemplatedParent}" />
</MultiBinding>
</dxe:TextEdit.IsEnabled>
</dxe:TextEdit>
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Position">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:SpinEdit EditMode="InplaceInactive" MinValue="0" IsFloatValue="False"
Value="{Binding Path=DataContext.RowData.Row.Position, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<dxe:SpinEdit x:Name="PART_Editor" EditMode="InplaceActive" MinValue="0" IsFloatValue="False"
Value="{Binding Path=DataContext.RowData.Row.Position, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Text">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:TextEdit EditMode="InplaceInactive" Text="{Binding Path=DataContext.RowData.Row.Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<dxe:TextEdit x:Name="PART_Editor" EditMode="InplaceActive" Text="{Binding Path=DataContext.RowData.Row.Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter}, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="ServiceCategory" Header="Leistungskategorie" AllowEditing="{Binding Path=DataContext.RowData.Row, Converter={StaticResource BoolReverseConverter}, RelativeSource={RelativeSource TemplatedParent}}">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:ComboBoxEdit EditMode="InplaceActive" IsEnabled="{Binding Path=DataContext.RowData.Row.IsParent, Converter={StaticResource BoolReverseConverter}, RelativeSource={RelativeSource TemplatedParent}}"
ItemsSource="{Binding Path=DataContext.PossibleCategories, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
SelectedItem="{Binding Path=DataContext.RowData.Row.ServiceCategory, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<dxe:ComboBoxEdit x:Name="PART_Editor" EditMode="InplaceActive" IsEnabled="{Binding Path=DataContext.RowData.Row.IsParent, Converter={StaticResource BoolReverseConverter}, RelativeSource={RelativeSource TemplatedParent}}"
ItemsSource="{Binding Path=DataContext.PossibleCategories, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
SelectedItem="{Binding Path=DataContext.RowData.Row.ServiceCategory, RelativeSource={RelativeSource TemplatedParent}}" />
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Parent" Header="Textbausteinkategorie">
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<dxe:ComboBoxEdit x:Name="PART_Editor" EditMode="InplaceActive"
ItemsSource="{Binding Path=DataContext.PossibleTextModuleParents, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
SelectedItem="{Binding Path=DataContext.RowData.Row.Parent, RelativeSource={RelativeSource TemplatedParent}}"/>
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView Name="TreeListView" AutoWidth="True" KeyFieldName="KeyField" ParentFieldName="ParentField" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
<StackPanel Grid.Column="0" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=detail:TextModuleView}, Path=IsInAdministrationView, Converter={StaticResource BoolVisibilityConverter}, ConverterParameter=false}">
<Button x:Name="SaveButton" HorizontalAlignment="Right" Margin="3" VerticalAlignment="Center" Content="Speichern" Click="SaveButton_OnClick" />
<Button x:Name="CancelButton" HorizontalAlignment="Right" Margin="3" VerticalAlignment="Center" Content="Schließen" />
</StackPanel>
</Grid>
</GroupBox>
</view:BeWoView>