Repository navigation
Expand file tree
/
Copy pathChatEmojiExample.xaml
More file actions
204 lines (203 loc) · 10.9 KB
/
Copy pathChatEmojiExample.xaml
File metadata and controls
204 lines (203 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<UserControl
x:Class="WPFDevelopers.Samples.ExampleViews.ChatEmojiExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<controls:CodeViewer Header="{Binding NavigateMenuItem.Name}">
<UniformGrid Width="800" Columns="2">
<Grid Margin="10,0" Background="{StaticResource WD.WarningBrush}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<RichTextBox x:Name="_LeftChat">
<RichTextBox.Background>
<ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/Chat/Left.jpg" Stretch="Fill" />
</RichTextBox.Background>
</RichTextBox>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ToggleButton
x:Name="LeftButtonEmoji"
Width="40"
Margin="10,0"
HorizontalAlignment="Left"
Content="Emoji" />
<Popup
AllowsTransparency="True"
IsOpen="{Binding ElementName=LeftButtonEmoji, Path=IsChecked}"
Placement="Top"
PlacementTarget="{Binding ElementName=LeftButtonEmoji}"
VerticalOffset="-4">
<Border
Width="76"
Margin="10"
Background="{DynamicResource WD.BackgroundBrush}"
CornerRadius="4">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Opacity="0.2"
ShadowDepth="0"
Color="#80000000" />
</Border.Effect>
<ItemsControl ItemsSource="{Binding EmojiArray, RelativeSource={RelativeSource AncestorType=local:ChatEmojiExample}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border
x:Name="PART_Border"
CornerRadius="2"
PreviewMouseLeftButtonDown="PART_Border_PreviewMouseLeftButtonDown"
Tag="{Binding Key}">
<Image
Width="30"
Height="30"
Margin="4"
IsHitTestVisible="True"
Source="{Binding Value}"
ToolTip="{Binding Name}" />
</Border>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Border" Property="Background" Value="#FFD8D1D1" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</Popup>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox x:Name="LeftInput" wd:ElementHelper.Watermark="请输入内容" />
<Button
x:Name="LeftSend"
Grid.Column="1"
Click="LeftSend_Click"
Content="发送"
Style="{StaticResource WD.PrimaryButton}" />
</Grid>
</Grid>
</Grid>
<Grid Margin="10,0" Background="{StaticResource WD.SuccessBrush}">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<RichTextBox x:Name="_RightChat">
<RichTextBox.Background>
<ImageBrush ImageSource="pack://application:,,,/WPFDevelopers.Samples;component/Resources/Images/Chat/Right.jpg" Stretch="Fill" />
</RichTextBox.Background>
</RichTextBox>
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<ToggleButton
x:Name="RightButtonEmoji"
Width="40"
Margin="10,0"
HorizontalAlignment="Left"
Content="Emoji" />
<Popup
AllowsTransparency="True"
IsOpen="{Binding ElementName=RightButtonEmoji, Path=IsChecked}"
Placement="Top"
PlacementTarget="{Binding ElementName=RightButtonEmoji}"
VerticalOffset="-4">
<Border
Width="76"
Margin="10"
Background="{DynamicResource WD.BackgroundBrush}"
CornerRadius="4">
<Border.Effect>
<DropShadowEffect
BlurRadius="10"
Opacity="0.2"
ShadowDepth="0"
Color="#80000000" />
</Border.Effect>
<ItemsControl ItemsSource="{Binding EmojiArray, RelativeSource={RelativeSource AncestorType=local:ChatEmojiExample}}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border
x:Name="PART_Border"
CornerRadius="2"
PreviewMouseLeftButtonDown="PART_Border_RightPreviewMouseLeftButtonDown"
Tag="{Binding Key}">
<Image
Width="30"
Height="30"
Margin="4"
IsHitTestVisible="True"
Source="{Binding Value}"
ToolTip="{Binding Name}" />
</Border>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="PART_Border" Property="Background" Value="#FFD8D1D1" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</Border>
</Popup>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox x:Name="RightInput" wd:ElementHelper.Watermark="请输入内容" />
<Button
x:Name="RightSend"
Grid.Column="1"
Click="RightSend_Click"
Content="发送"
Style="{StaticResource WD.PrimaryButton}" />
</Grid>
</Grid>
</Grid>
</UniformGrid>
<controls:CodeViewer.SourceCodes>
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/ChatEmojiExample.xaml" CodeType="Xaml" />
<controls:SourceCodeModel CodeSource="/WPFDevelopers.SamplesCode;component/ExampleViews/ChatEmojiExample.xaml.cs" CodeType="CSharp" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/Controls/ChatEmoji/ChatEmoji.xaml"
CodeType="Xaml"
Haader="ChatEmoji" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/Controls/ChatEmoji/EmojiHelper.cs"
CodeType="CSharp"
Haader="EmojiHelper.cs" />
<controls:SourceCodeModel
CodeSource="/WPFDevelopers.SamplesCode;component/Controls/ChatEmoji/ChatEmoji.cs"
CodeType="CSharp"
Haader="ChatEmoji.cs" />
</controls:CodeViewer.SourceCodes>
</controls:CodeViewer>
</UserControl>