添加项目文件。
This commit is contained in:
74
Views/ChatMdView.xaml
Normal file
74
Views/ChatMdView.xaml
Normal file
@@ -0,0 +1,74 @@
|
||||
<UserControl x:Class="YwxApp.AiChat.Views.ChatMdView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources >
|
||||
<ResourceDictionary>
|
||||
<!--Resource dictionary:Add control style.-->
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Style/ButtonStyle.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid Background="#0F000F">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!--First line: Display output text to "Markdown" container-->
|
||||
<Grid Grid.Row="0">
|
||||
<ScrollViewer Background="#FFFFFF" x:Name="MarkDownScrollViewer">
|
||||
<!--Bind event command to the ScrollViewer-->
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="ScrollChanged">
|
||||
<i:InvokeCommandAction Command = "{Binding ScrollToEndCommand}"
|
||||
CommandParameter="{Binding ElementName=MarkDownScrollViewer}" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<!--scrollviewer internal container-->
|
||||
<markdig:MarkdownViewer x:Name="MarkdownOutputBox" Markdown="{Binding MarkdownContent}" />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
|
||||
<!-- the second line -->
|
||||
<Grid Grid.Row="1">
|
||||
<TextBox x:Name="InputBox"
|
||||
Text="{Binding InputText , Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Grid.Row="1" Margin="5" AcceptsReturn="True"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<!--key binding of "Enter"-->
|
||||
<TextBox.InputBindings>
|
||||
<KeyBinding Command="{Binding SubmitQuestionCommand}" Key="Enter"/>
|
||||
</TextBox.InputBindings>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
|
||||
<!-- The third line: submit button -->
|
||||
<Grid Grid.Row="2">
|
||||
<WrapPanel Grid.Row="2" HorizontalAlignment="Right">
|
||||
|
||||
<Button x:Name="BtnNewChat" Content="新建会话"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource RoundCornerButtonStyle}"
|
||||
Command="{Binding NewSessionCommand}"
|
||||
Width="100"
|
||||
Height="30"/>
|
||||
<Button x:Name="BtnSubmit" Content="提交"
|
||||
HorizontalAlignment="Right"
|
||||
Style="{StaticResource RoundCornerButtonStyle}"
|
||||
Command="{Binding SubmitQuestionCommand}"
|
||||
Width="100"
|
||||
Height="30"/>
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user