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

192 lines
15 KiB
XML

<view:BeWoView x:Class="BeWo.View.Detail.TextbausteinView"
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:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:detail="clr-namespace:BeWo.View.Detail"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
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" Header="Aktuell definierte Textbausteine" Style="{StaticResource ObjectEditGroupBox}">
<Grid VerticalAlignment="Stretch">
<Grid.Resources>
<ContextMenu x:Key="ContextMenuTextModules" MenuItem.Click="ContextMenuTextModules_Click" Opened="ContextMenuTextModules_Opened">
<MenuItem Header="Neue Textbausteinkategorie">
<MenuItem.Icon>
<Image Source="..\..\Ressources\Icons\Add24.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Neuer Textbaustein">
<MenuItem.Icon>
<Image Source="..\..\Ressources\Icons\Add24.png"/>
</MenuItem.Icon>
</MenuItem>
</ContextMenu>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Name" />
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=NewVM.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="150" />
<Label Grid.Column="2" Grid.Row="0" Content="Text" />
<TextBox Grid.Column="3" Grid.Row="0" Grid.RowSpan="4" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" Text="{Binding Path=NewVM.Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="{Binding Path=NewVM.IsParent, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolReverseConverter}}" />
<Label Grid.Column="0" Grid.Row="1" Content="Textbausteinkategorie" />
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="1" Margin="3" Height="23" Width="150" EditMode="Standalone"
ItemsSource="{Binding Path=PossibleTextModuleParents}"
SelectedItem="{Binding Path=NewVM.Parent}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="RemoveParentTextModuleFromNewVM_OnClick" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
<Label Grid.Column="0" Grid.Row="2" Content="Leistungskategorie" />
<dxe:ComboBoxEdit Grid.Column="1" Grid.Row="2" Margin="3" Height="23" Width="150" EditMode="Standalone"
IsEnabled="{Binding Path=NewVM.IsParent, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolReverseConverter}}"
ItemsSource="{Binding Path=PossibleCategories}"
SelectedItem="{Binding Path=NewVM.ServiceCategory}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="RemoveServiceCategoryFromNewVM_OnClick" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
<CheckBox Grid.Column="0" Grid.Row="3" Content="Ist Textbausteinkategorie" Margin="3" IsChecked="{Binding Path=NewVM.IsParent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Checked="IsTextModuleParent_Checked" />
<Button Grid.Column="0" Grid.Row="4" Grid.ColumnSpan="4" HorizontalAlignment="Right" Content="Hinzufügen" Margin="3,3,0,3" Click="AddTextModuleButton_Click" />
<dxg:TreeListControl Name="TreeListControl" Grid.Column="0" Grid.ColumnSpan="4" Grid.Row="5" dx:ThemeManager.ThemeName="Office2010Black" ItemsSource="{Binding Path=VMList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
Margin="0" ContextMenu="{StaticResource ContextMenuTextModules}"
ItemsSourceChanged="TreeListControl_OnItemsSourceChanged"
PreviewMouseDown="TreeListControl_OnPreviewMouseDown">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn FieldName="IsDeleteable" FixedWidth="True" Width="24" ReadOnly="True" Header=" ">
<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="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}}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="RemoveServiceCategory_OnClick" Tag="{Binding}" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
</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}}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="RemoveServiceCategory_OnClick" Tag="{Binding}" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Parent" Header="Textbausteinkategorie">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:ComboBoxEdit EditMode="InplaceActive" IsTextEditable="False"
ItemsSource="{Binding Path=DataContext.PossibleTextModuleParents, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
SelectedItem="{Binding Path=DataContext.RowData.Row.Parent, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Tag="{Binding Path=DataContext.RowData.Row, RelativeSource={RelativeSource TemplatedParent}}"
Loaded="FrameworkElement_OnLoaded">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="ButtonInfo_OnClick" Tag="{Binding}" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<!-- Textbausteinkategorie -->
<dxe:ComboBoxEdit x:Name="PART_Editor" EditMode="InplaceActive" IsTextEditable="False"
ItemsSource="{Binding Path=DataContext.PossibleTextModuleParents, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
SelectedItem="{Binding Path=DataContext.RowData.Row.Parent, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
EditValueChanged="PART_Editor_OnEditValueChanged"
Tag="{Binding Path=DataContext.RowData.Row, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Loaded="FrameworkElement_OnLoaded">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo GlyphKind="Cancel" Click="ButtonInfo_OnClick" Tag="{Binding}" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
</ControlTemplate>
</dxg:TreeListColumn.EditTemplate>
</dxg:TreeListColumn>
</dxg:TreeListControl.Columns>
<dxg:TreeListControl.View>
<dxg:TreeListView Name="TreeListView" AutoWidth="True" KeyFieldName="KeyField" ParentFieldName="ParentField"
ExpandStateBinding="{Binding Path=IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
/>
</dxg:TreeListControl.View>
</dxg:TreeListControl>
</Grid>
</GroupBox>
</view:BeWoView>