Files
29WxOrder/OrderSupportTicket/Views/TicketComposerView.xaml
T
2026-10-20 17:03:23 +08:00

198 lines
6.1 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<UserControl
x:Class="OrderSupportTicket.Views.TicketComposerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="clr-namespace:OrderSupportTicket.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:OrderSupportTicket.ViewModels"
xmlns:wpf="WPFCommon">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="OrderSupportTicketStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
<wpf:CommandProxy x:Key="AddImagesCommand" Command="{Binding AddImagesCommand}" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Border
Padding="18,12"
BorderBrush="#DDE2E8"
BorderThickness="0,1,0,0"
Visibility="{Binding IsChatVisible, Converter={StaticResource BoolToVisibility}}">
<Border
Padding="12,10"
Background="White"
BorderBrush="#DDE2E8"
BorderThickness="1"
CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ItemsControl
Margin="0,0,0,8"
ItemsSource="{Binding PendingAttachments}"
Visibility="{Binding HasPendingAttachments, Converter={StaticResource BoolToVisibility}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate DataType="{x:Type vm:PendingAttachmentViewModel}">
<Grid
Width="76"
Height="76"
Margin="0,0,8,4"
ToolTip="{Binding FileName}">
<Border
Background="#F1F3F6"
BorderBrush="#DDE2E8"
BorderThickness="1"
ClipToBounds="True"
CornerRadius="5">
<Grid>
<Image Source="{Binding Preview}" Stretch="UniformToFill" />
</Grid>
</Border>
<Button
Margin="0,-6,-6,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Command="{Binding DataContext.RemovePendingAttachmentCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
CommandParameter="{Binding}"
Content="×"
Style="{StaticResource AttachmentRemoveButtonStyle}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBox
Grid.Row="1"
MinHeight="64"
MaxHeight="110"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
MaxLength="4000"
PreviewKeyDown="ChatTextBox_PreviewKeyDown"
Text="{Binding ChatText, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap"
ToolTip="{Binding ComposerPlaceholder}"
VerticalScrollBarVisibility="Auto">
<TextBox.InputBindings>
<KeyBinding
Key="Enter"
Command="{Binding SendMessageCommand}"
Modifiers="Control" />
</TextBox.InputBindings>
</TextBox>
<Grid Grid.Row="2" Margin="0,8,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal">
<Button
Height="28"
Padding="9,0"
Command="{Binding Source={StaticResource AddImagesCommand}}"
CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Content="图片"
Style="{StaticResource GhostButtonStyle}" />
<TextBlock
Margin="8,0,0,0"
VerticalAlignment="Center"
FontSize="12"
Foreground="#6B7785"
Text="{Binding AttachmentCountText}" />
<TextBlock
Margin="12,0,0,0"
VerticalAlignment="Center"
FontSize="12"
Foreground="#6B7785"
Text="Ctrl+Enter 发送" />
</StackPanel>
<StackPanel Grid.Column="1" Orientation="Horizontal">
<TextBlock
Margin="0,0,10,0"
VerticalAlignment="Center"
FontSize="12"
Foreground="#6B7785"
Text="{Binding ChatCharacterCountText}" />
<Button
Width="72"
Height="32"
Command="{Binding SendMessageCommand}"
Content="发送"
Style="{StaticResource PrimaryButtonStyle}" />
</StackPanel>
</Grid>
</Grid>
</Border>
</Border>
<Border
Padding="18,12"
BorderBrush="#DDE2E8"
BorderThickness="0,1,0,0"
Visibility="{Binding IsDraftVisible, Converter={StaticResource BoolToVisibility}}">
<Border
Padding="12,10"
Background="White"
BorderBrush="#DDE2E8"
BorderThickness="1"
CornerRadius="8">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBox
MinHeight="64"
MaxHeight="110"
AcceptsReturn="True"
Background="Transparent"
BorderThickness="0"
MaxLength="2000"
Text="{Binding DraftText, UpdateSourceTrigger=PropertyChanged}"
TextWrapping="Wrap"
ToolTip="请描述您遇到的问题"
VerticalScrollBarVisibility="Auto">
<TextBox.InputBindings>
<KeyBinding
Key="Enter"
Command="{Binding CreateTicketCommand}"
Modifiers="Control" />
</TextBox.InputBindings>
</TextBox>
<Grid Grid.Row="1" Margin="0,8,0,0">
<TextBlock
VerticalAlignment="Center"
FontSize="12"
Foreground="#6B7785"
Text="Ctrl+Enter 提交" />
<TextBlock
Margin="0,0,96,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="12"
Foreground="#6B7785"
Text="{Binding DraftCharacterCountText}" />
<Button
Width="86"
Height="32"
HorizontalAlignment="Right"
Command="{Binding CreateTicketCommand}"
Content="提交工单"
Style="{StaticResource PrimaryButtonStyle}" />
</Grid>
</Grid>
</Border>
</Border>
</Grid>
</UserControl>