forked from microsoft/Cognitive-Samples-IntelligentKiosk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHighlightField.xaml
48 lines (44 loc) · 2.6 KB
/
HighlightField.xaml
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
<UserControl
x:Class="IntelligentKioskSample.Views.FormRecognizer.HighlightField"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ctl="using:IntelligentKioskSample.Controls"
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
xmlns:p="using:IntelligentKioskSample.Controls.Overlays.Primitives"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
x:Name="userControl">
<UserControl.Resources>
<ctl:CollectionCountToVisibilityConverter x:Key="collectionCountToVisibilityConverter"/>
<ctl:StringLengthToVisibilityConverter x:Key="stringLengthToVisibilityConverter"/>
</UserControl.Resources>
<Grid Visibility="{Binding ReceiptField.OverlayInfo.Length, ElementName=userControl, Converter={StaticResource collectionCountToVisibilityConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*"/>
<ColumnDefinition Width="{Binding NormalizeValueColumnLength, ElementName=userControl}"/>
</Grid.ColumnDefinitions>
<StackPanel Spacing="5">
<TextBlock Text="{Binding LabelField, ElementName=userControl}" Style="{StaticResource CaptionTextBlockStyle}"
Visibility="{Binding LabelField, ElementName=userControl, Converter={StaticResource stringLengthToVisibilityConverter}}"/>
<ItemsControl ItemsSource="{Binding ReceiptField.OverlayInfo, ElementName=userControl}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<controls:WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<p:OverlayHighlight Margin="0,0,3,0" HighlightTemplate="{StaticResource Overlay.BorderHighlightWord}">
<TextBlock Text="{Binding Entity.Name}" IsTextSelectionEnabled="True" TextTrimming="CharacterEllipsis"/>
</p:OverlayHighlight>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
<TextBlock Grid.Column="1" Text="{Binding ReceiptField.ReceiptItem.Value, ElementName=userControl}" Margin="10,5,0,0"
Foreground="LightGray" Opacity="0.7" TextWrapping="WrapWholeWords" VerticalAlignment="Bottom"/>
</Grid>
</UserControl>