Files
BeWoPlaner/BeWo/View/Detail/AI/AiPromptbausteinView.xaml

249 lines
14 KiB
XML

<view:BeWoView
x:Class="BeWo.View.Detail.AI.AiPromptbausteinView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:detail1="clr-namespace:BeWo.View.Detail.AI"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid"
xmlns:view="clr-namespace:BeWo.View"
Width="Auto"
Height="Auto"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Focusable="True">
<view:BeWoView.Resources>
<detail1:IsOnlyForEmployeeRightsConverter2 x:Key="IsOnlyForEmployeeRightsConverter2" />
<detail1:AiPromptbausteinEditConverter x:Key="AiPromptbausteinEditConverter" />
</view:BeWoView.Resources>
<GroupBox
Name="root"
Header="Aktuell definierte KI-Prompts"
Style="{StaticResource ObjectEditGroupBox}">
<Grid VerticalAlignment="Stretch">
<Grid.Resources>
<ContextMenu
x:Key="ContextMenuAiPromptbausteine"
MenuItem.Click="ContextMenuAiPromptbausteine_Click"
Opened="ContextMenuAiPromptbausteine_Opened">
<MenuItem Header="Neue KI Prompt-Kategorie">
<MenuItem.Icon>
<Image Source="..\..\..\Ressources\Icons\Add24.png" />
</MenuItem.Icon>
</MenuItem>
<MenuItem Header="Neuer KI-Prompt">
<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="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label
Grid.Row="0"
Grid.Column="0"
Content="Name" />
<TextBox
Grid.Row="0"
Grid.Column="1"
Width="150"
Text="{Binding Path=NewVM.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Label
Grid.Row="0"
Grid.Column="2"
Content="Text" />
<TextBox
Grid.Row="0"
Grid.RowSpan="2"
Grid.Column="3"
AcceptsReturn="True"
IsEnabled="{Binding Path=NewVM.IsParent, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BoolReverseConverter}}"
Text="{Binding Path=NewVM.Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
VerticalScrollBarVisibility="Auto" />
<Label
Grid.Row="1"
Grid.Column="0"
Content="KI Prompt-Kategorie" />
<dxe:ComboBoxEdit
Grid.Row="1"
Grid.Column="1"
Width="150"
Height="23"
Margin="3"
EditMode="Standalone"
ItemsSource="{Binding Path=PossibleAiPromptbausteinParents}"
SelectedItem="{Binding Path=NewVM.Parent}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo Click="RemoveParentAiPromptbausteinFromNewVM_OnClick" GlyphKind="Cancel" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
<CheckBox
Grid.Row="2"
Grid.Column="0"
Margin="3"
Checked="IsAiPromptbausteinParent_Checked"
Content="KI-Promptbaustein-Kategorie"
IsChecked="{Binding Path=NewVM.IsParent, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
<Button
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="4"
Margin="3,3,0,3"
HorizontalAlignment="Right"
Click="AddAiPromptbausteinButton_Click"
Content="Hinzufügen" />
<dxg:TreeListControl
Name="TreeListControl"
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="4"
Margin="0"
dx:ThemeManager.ThemeName="Office2010Black"
ContextMenu="{StaticResource ContextMenuAiPromptbausteine}"
ItemsSource="{Binding Path=VMList, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ItemsSourceChanged="TreeListControl_ItemsSourceChanged"
PreviewMouseDown="TreeListControl_OnPreviewMouseDown">
<dxg:TreeListControl.Columns>
<dxg:TreeListColumn
Width="24"
FieldName="IsDeleteable"
FixedWidth="True"
Header=" "
ReadOnly="True">
<dxg:TreeListColumn.CellTemplate>
<DataTemplate>
<Button
Width="18"
Height="18"
VerticalAlignment="Center"
Click="DeleteButton_Click"
Content="r"
FontFamily="Webdings">
<Button.IsEnabled>
<MultiBinding Converter="{StaticResource AiPromptbausteinEditConverter}">
<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 AiPromptbausteinEditConverter}">
<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 AiPromptbausteinEditConverter}">
<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.CellTemplate>
<DataTemplate>
<dxe:TextEdit
x:Name="PART_Editor"
AcceptsReturn="True"
AcceptsTab="True"
EditMode="InplaceActive"
IsEnabled="{Binding Path=DataContext.RowData.Row, Converter={StaticResource IsOnlyForEmployeeRightsConverter2}, RelativeSource={RelativeSource TemplatedParent}}"
SelectAllOnGotFocus="False"
SelectAllOnMouseUp="False"
Text="{Binding Path=DataContext.RowData.Row.Text, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
TextTrimming="WordEllipsis"
TextWrapping="Wrap" />
</DataTemplate>
</dxg:TreeListColumn.CellTemplate>
</dxg:TreeListColumn>
<dxg:TreeListColumn FieldName="Parent" Header="KI Prompt-Kategorie">
<dxg:TreeListColumn.DisplayTemplate>
<ControlTemplate>
<dxe:ComboBoxEdit
EditMode="InplaceActive"
IsTextEditable="False"
ItemsSource="{Binding Path=DataContext.PossibleAiPromptbausteinParents, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
Loaded="FrameworkElement_OnLoaded"
SelectedItem="{Binding Path=DataContext.RowData.Row.Parent, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Tag="{Binding Path=DataContext.RowData.Row, RelativeSource={RelativeSource TemplatedParent}}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo
Click="ButtonInfo_OnClick"
GlyphKind="Cancel"
Tag="{Binding}" />
</dxe:ComboBoxEdit.Buttons>
</dxe:ComboBoxEdit>
</ControlTemplate>
</dxg:TreeListColumn.DisplayTemplate>
<dxg:TreeListColumn.EditTemplate>
<ControlTemplate>
<!-- KI Prompt-Kategorie -->
<dxe:ComboBoxEdit
x:Name="PART_Editor"
EditMode="InplaceActive"
EditValueChanged="PART_Editor_OnEditValueChanged"
IsTextEditable="False"
ItemsSource="{Binding Path=DataContext.PossibleAiPromptbausteinParents, RelativeSource={RelativeSource FindAncestor, AncestorType=dxg:TreeListControl}}"
Loaded="FrameworkElement_OnLoaded"
SelectedItem="{Binding Path=DataContext.RowData.Row.Parent, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
Tag="{Binding Path=DataContext.RowData.Row, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}">
<dxe:ComboBoxEdit.Buttons>
<dxe:ButtonInfo
Click="ButtonInfo_OnClick"
GlyphKind="Cancel"
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"
ExpandStateBinding="{Binding Path=IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
KeyFieldName="KeyField"
ParentFieldName="ParentField" />
</dxg:TreeListControl.View>
</dxg:TreeListControl>
</Grid>
</GroupBox>
</view:BeWoView>