on master help sign in
Merge pull request #1655 from mohamed-abdelnour/support-xaml-files

Add support for XAML files

commit52c11fe23d2d9ed027fae81d2f84de48710ac9ff authorKeith Hall <keith-hall@users.noreply.github.com> dateSat 15 May 2021, 10:02 (5 years ago) parent93f710b6fc9641
6 files changed+565
CHANGELOG.md+2 assets/patches/XML.sublime-syntax.patch+12 assets/syntaxes.bin tests/syntax-tests/highlighted/XAML/ItemPage.xaml+264 tests/syntax-tests/source/XAML/ItemPage.xaml+264 tests/syntax-tests/source/XAML/LICENSE.md+23
CHANGELOG.md+2
@@ -11,6 +11,8 @@
1111
1212## Syntaxes
1313
14+- Added support for `XAML` syntax, see #1590 and #1655 (@mohamed-abdelnour)
15+
1416
1517## New themes
1618
assets/patches/XML.sublime-syntax.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git syntaxes/01_Packages/XML/XML.sublime-syntax syntaxes/01_Packages/XML/XML.sublime-syntax
2+index ad7d9c87..af4a00f0 100644
3+--- syntaxes/01_Packages/XML/XML.sublime-syntax
4++++ syntaxes/01_Packages/XML/XML.sublime-syntax
5+@@ -12,6 +12,7 @@ file_extensions:
6+ - rss
7+ - opml
8+ - svg
9++ - xaml
10+ first_line_match: |-
11+ (?x:
12+ ^(?:
assets/syntaxes.bin

Binary file not shown.

tests/syntax-tests/highlighted/XAML/ItemPage.xamlnew file+264
@@ -0,0 +1,264 @@
1+<!--
2+ //*********************************************************
3+ //
4+ // Copyright (c) Microsoft. All rights reserved.
5+ // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6+ // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7+ // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8+ // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9+ //
10+ //*********************************************************
11+-->
12+<Page
13+ x:Class="AppUIBasics.ItemPage"
14+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
15+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
16+ xmlns:common="using:AppUIBasics.Common"
17+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
18+ xmlns:data="using:AppUIBasics.Data"
19+ xmlns:local="using:AppUIBasics"
20+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
21+ x:Name="pageRoot"
22+ mc:Ignorable="d">
23+
24+ <!--
25+ This grid acts as a root panel for the page that defines two rows:
26+ * Row 0 contains the back button and page title
27+ * Row 1 contains the rest of the page layout
28+ -->
29+ <Grid x:Name="rootPanel" d:DataContext="{Binding Groups[0].Items[0], Source={d:DesignData Source=/DataModel/ControlinfoData.json, Type=data:ControlInfoDataSource}}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
30+ <VisualStateManager.VisualStateGroups>
31+ <VisualStateGroup>
32+ <VisualState>
33+ <VisualState.StateTriggers>
34+ <local:DeviceFamilyTrigger DeviceFamily="Windows.Xbox" />
35+ </VisualState.StateTriggers>
36+ <VisualState.Setters>
37+ <Setter Target="svPanel.Margin" Value="0,0,48,27" />
38+ </VisualState.Setters>
39+ </VisualState>
40+ </VisualStateGroup>
41+ <VisualStateGroup>
42+ <VisualState x:Name="NormalFrameContent" />
43+ <VisualState x:Name="WideFrameContent">
44+ <VisualState.Setters>
45+ <Setter Target="contentFrame.Width" Value="1028" />
46+ <Setter Target="contentFrame.HorizontalAlignment" Value="Left" />
47+ </VisualState.Setters>
48+ </VisualState>
49+ </VisualStateGroup>
50+ <VisualStateGroup x:Name="LayoutVisualStates">
51+ <VisualState x:Name="LargeLayout">
52+ <VisualState.StateTriggers>
53+ <AdaptiveTrigger MinWindowWidth="1372" />
54+ </VisualState.StateTriggers>
55+ </VisualState>
56+ <VisualState x:Name="WideLayout">
57+ <VisualState.StateTriggers>
58+ <AdaptiveTrigger MinWindowWidth="{StaticResource Breakpoint640Plus}" />
59+ </VisualState.StateTriggers>
60+ <VisualState.Setters>
61+ <Setter Target="seeAlsoPanel.Width" Value="Auto" />
62+ <Setter Target="seeAlsoPanel.(Grid.Row)" Value="3" />
63+ <Setter Target="seeAlsoPanel.(Grid.Column)" Value="0" />
64+ <Setter Target="seeAlsoPanel.(Grid.ColumnSpan)" Value="3" />
65+
66+ <Setter Target="SourcePanel.(Grid.ColumnSpan)" Value="1" />
67+
68+ <Setter Target="DocumentationPanel.(Grid.ColumnSpan)" Value="1" />
69+
70+ <Setter Target="RelatedControlsPanel.(Grid.Row)" Value="0" />
71+ <Setter Target="RelatedControlsPanel.(Grid.Column)" Value="2" />
72+ <Setter Target="RelatedControlsPanel.(Grid.ColumnSpan)" Value="1" />
73+
74+ <Setter Target="FeedbackPanel.(Grid.Row)" Value="1" />
75+ <Setter Target="FeedbackPanel.(Grid.Column)" Value="2" />
76+ <Setter Target="FeedbackPanel.(Grid.ColumnSpan)" Value="1" />
77+ </VisualState.Setters>
78+ </VisualState>
79+ <VisualState x:Name="NarrowLayout">
80+ <VisualState.StateTriggers>
81+ <AdaptiveTrigger MinWindowWidth="0" />
82+ </VisualState.StateTriggers>
83+ <VisualState.Setters>
84+ <Setter Target="seeAlsoPanel.Width" Value="Auto" />
85+ <Setter Target="seeAlsoPanel.(Grid.Row)" Value="3" />
86+ <Setter Target="seeAlsoPanel.(Grid.Column)" Value="0" />
87+ <Setter Target="seeAlsoPanel.(Grid.ColumnSpan)" Value="3" />
88+
89+ <Setter Target="SourcePanel.(Grid.ColumnSpan)" Value="1" />
90+
91+ <Setter Target="DocumentationPanel.(Grid.ColumnSpan)" Value="1" />
92+
93+ <Setter Target="RelatedControlsPanel.(Grid.Row)" Value="0" />
94+ <Setter Target="RelatedControlsPanel.(Grid.Column)" Value="2" />
95+ <Setter Target="RelatedControlsPanel.(Grid.ColumnSpan)" Value="1" />
96+
97+ <Setter Target="FeedbackPanel.(Grid.Row)" Value="1" />
98+ <Setter Target="FeedbackPanel.(Grid.Column)" Value="2" />
99+ <Setter Target="FeedbackPanel.(Grid.ColumnSpan)" Value="1" />
100+
101+ <Setter Target="rightMargin.Width" Value="0" />
102+ <Setter Target="contentRoot.Padding" Value="14,0" />
103+ </VisualState.Setters>
104+ </VisualState>
105+ </VisualStateGroup>
106+ </VisualStateManager.VisualStateGroups>
107+
108+ <!-- Content Region -->
109+ <ScrollViewer
110+ x:Name="svPanel"
111+
112+ VerticalScrollBarVisibility="Auto"
113+ VerticalScrollMode="Auto">
114+ <Grid x:Name="contentRoot" Padding="24,0,0,0" SizeChanged="OnContentRootSizeChanged">
115+ <Grid.ColumnDefinitions>
116+ <ColumnDefinition x:Name="contentColumn" />
117+ <ColumnDefinition x:Name="rightMargin" Width="20" />
118+ <ColumnDefinition x:Name="infoColumn" Width="Auto" />
119+ </Grid.ColumnDefinitions>
120+ <Grid.RowDefinitions>
121+ <RowDefinition Height="Auto" />
122+ <RowDefinition Height="*" />
123+ <RowDefinition Height="20" />
124+ <RowDefinition Height="Auto" />
125+ </Grid.RowDefinitions>
126+
127+ <TextBlock
128+ x:Name="descriptionText"
129+ Style="{ThemeResource BodyTextBlockStyle}"
130+ Grid.ColumnSpan="2"
131+ Margin="0,5,24,0"
132+ Text="{x:Bind Item.Description}" />
133+
134+ <Frame x:Name="contentFrame" Grid.Row="1" />
135+
136+ <Grid
137+ x:Name="seeAlsoPanel"
138+ Grid.Row="0"
139+ Grid.RowSpan="2"
140+ Grid.Column="2"
141+ Width="280"
142+ Margin="0,0,24,24">
143+ <Grid.RowDefinitions>
144+ <RowDefinition Height="Auto" />
145+ <RowDefinition Height="Auto" />
146+ <RowDefinition Height="Auto" />
147+ <RowDefinition Height="Auto" />
148+ </Grid.RowDefinitions>
149+ <Grid.ColumnDefinitions>
150+ <ColumnDefinition />
151+ <ColumnDefinition Width="20" />
152+ <ColumnDefinition />
153+ </Grid.ColumnDefinitions>
154+
155+ <StackPanel x:Name="SourcePanel" Grid.Row="0" Grid.ColumnSpan="3" Margin="0,0,0,40">
156+ <TextBlock
157+ x:Name="SourceHeader"
158+ x:Uid="SourceHeader"
159+ Style="{ThemeResource SubtitleTextBlockStyle}"
160+ Text="View page code on GitHub"/>
161+ <HyperlinkButton
162+ x:Name="PageMarkupGitHubLink"
163+ ToolTipService.ToolTip="{x:Bind PageMarkupGitHubLink.NavigateUri, Mode=OneWay}">
164+ <TextBlock Text="XAML source code"/>
165+ </HyperlinkButton>
166+ <HyperlinkButton
167+ x:Name="PageCodeGitHubLink"
168+ ToolTipService.ToolTip="{x:Bind PageCodeGitHubLink.NavigateUri, Mode=OneWay}"
169+ Margin="0,12,0,0">
170+ <TextBlock Text="C# source code"/>
171+ </HyperlinkButton>
172+ </StackPanel>
173+
174+ <StackPanel x:Name="DocumentationPanel" Grid.Row="1" Grid.ColumnSpan="3" Margin="0,0,0,40">
175+ <TextBlock
176+ x:Name="docHeader"
177+ x:Uid="DocHeader"
178+ Style="{StaticResource SubtitleTextBlockStyle}" />
179+ <ItemsControl
180+ x:Name="DocsList"
181+ Margin="0,12,0,0"
182+ IsTabStop="False"
183+ ItemsSource="{x:Bind Item.Docs}">
184+ <ItemsControl.ItemsPanel>
185+ <ItemsPanelTemplate>
186+ <StackPanel Orientation="Vertical" />
187+ </ItemsPanelTemplate>
188+ </ItemsControl.ItemsPanel>
189+ <ItemsControl.ItemTemplate>
190+ <DataTemplate x:DataType="data:ControlInfoDocLink">
191+ <HyperlinkButton NavigateUri="{Binding Uri}" ToolTipService.ToolTip="{Binding Uri}">
192+ <TextBlock Text="{x:Bind Title}" />
193+ </HyperlinkButton>
194+ </DataTemplate>
195+ </ItemsControl.ItemTemplate>
196+ </ItemsControl>
197+ </StackPanel>
198+
199+ <StackPanel x:Name="RelatedControlsPanel" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,0,0,40">
200+ <TextBlock
201+ x:Name="relatedControlsHeader"
202+ x:Uid="RelatedControlsHeader"
203+ Style="{StaticResource SubtitleTextBlockStyle}" />
204+
205+ <ItemsControl
206+ x:Name="relatedItemsControl"
207+ Margin="0,12,0,0"
208+ IsTabStop="False"
209+ ItemsSource="{x:Bind Item.RelatedControls}">
210+ <ItemsControl.ItemsPanel>
211+ <ItemsPanelTemplate>
212+ <StackPanel Orientation="Vertical" />
213+ </ItemsPanelTemplate>
214+ </ItemsControl.ItemsPanel>
215+ <ItemsControl.ItemTemplate>
216+ <DataTemplate x:DataType="x:String">
217+ <!-- A HyperlinkButton must always provide an accessible name to a screen reader which
218+ conveys the purpose of the link. By default, when the HyperlinkButton is built
219+ as below, with an Image and TextBlock, the HyperlinkButton provides no accessible
220+ name. So bind the accessible name to the same data that provides the text shown
221+ visually on the contained TextBlock. -->
222+ <HyperlinkButton AutomationProperties.Name="{x:Bind}" Click="OnRelatedControlClick">
223+ <RelativePanel>
224+ <!-- Now that the HyperlinkButton has a helpful accessible name, it serves no
225+ useful purpose for the contained Image, (which is purely decorative,) or
226+ the contained TextBlock to be exposed to a screen reader. All the information
227+ required by customers using a screen reader is accessible directly through the
228+ Hyperlink button. As such, mark the contained elements as not being interesting
229+ to a screen reader through use of the AutomationProperties.AccessibilityView
230+ property. -->
231+ <Image
232+ AutomationProperties.AccessibilityView="Raw"
233+ x:Name="iconImage"
234+ Width="25"
235+ Margin="0,0,15,0"
236+ common:ImageLoader.Source="{Binding}" />
237+ <TextBlock
238+ AutomationProperties.AccessibilityView="Raw"
239+ Foreground="{ThemeResource HyperlinkButtonForeground}"
240+ RelativePanel.RightOf="iconImage"
241+ Text="{x:Bind}"
242+ TextWrapping="Wrap" />
243+ </RelativePanel>
244+ </HyperlinkButton>
245+ </DataTemplate>
246+ </ItemsControl.ItemTemplate>
247+ </ItemsControl>
248+ </StackPanel>
249+
250+ <StackPanel x:Name="FeedbackPanel" Grid.Row="3" Grid.ColumnSpan="3">
251+ <TextBlock
252+ x:Name="feedbackHeader"
253+ x:Uid="FeedbackHeader"
254+ Style="{StaticResource SubtitleTextBlockStyle}" />
255+ <HyperlinkButton NavigateUri="https://github.com/microsoft/Xaml-Controls-Gallery/issues/new/choose" 
256+ ToolTipService.ToolTip="https://github.com/microsoft/Xaml-Controls-Gallery/issues/new/choose">
257+ <TextBlock x:Uid="FeedbackLink" />
258+ </HyperlinkButton>
259+ </StackPanel>
260+ </Grid>
261+ </Grid>
262+ </ScrollViewer>
263+ </Grid>
264+</Page>
tests/syntax-tests/source/XAML/ItemPage.xamlnew file+264
@@ -0,0 +1,264 @@
1+<!--
2+ //*********************************************************
3+ //
4+ // Copyright (c) Microsoft. All rights reserved.
5+ // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6+ // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7+ // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8+ // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9+ //
10+ //*********************************************************
11+-->
12+<Page
13+ x:Class="AppUIBasics.ItemPage"
14+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
15+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
16+ xmlns:common="using:AppUIBasics.Common"
17+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
18+ xmlns:data="using:AppUIBasics.Data"
19+ xmlns:local="using:AppUIBasics"
20+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
21+ x:Name="pageRoot"
22+ mc:Ignorable="d">
23+
24+ <!--
25+ This grid acts as a root panel for the page that defines two rows:
26+ * Row 0 contains the back button and page title
27+ * Row 1 contains the rest of the page layout
28+ -->
29+ <Grid x:Name="rootPanel" d:DataContext="{Binding Groups[0].Items[0], Source={d:DesignData Source=/DataModel/ControlinfoData.json, Type=data:ControlInfoDataSource}}" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
30+ <VisualStateManager.VisualStateGroups>
31+ <VisualStateGroup>
32+ <VisualState>
33+ <VisualState.StateTriggers>
34+ <local:DeviceFamilyTrigger DeviceFamily="Windows.Xbox" />
35+ </VisualState.StateTriggers>
36+ <VisualState.Setters>
37+ <Setter Target="svPanel.Margin" Value="0,0,48,27" />
38+ </VisualState.Setters>
39+ </VisualState>
40+ </VisualStateGroup>
41+ <VisualStateGroup>
42+ <VisualState x:Name="NormalFrameContent" />
43+ <VisualState x:Name="WideFrameContent">
44+ <VisualState.Setters>
45+ <Setter Target="contentFrame.Width" Value="1028" />
46+ <Setter Target="contentFrame.HorizontalAlignment" Value="Left" />
47+ </VisualState.Setters>
48+ </VisualState>
49+ </VisualStateGroup>
50+ <VisualStateGroup x:Name="LayoutVisualStates">
51+ <VisualState x:Name="LargeLayout">
52+ <VisualState.StateTriggers>
53+ <AdaptiveTrigger MinWindowWidth="1372" />
54+ </VisualState.StateTriggers>
55+ </VisualState>
56+ <VisualState x:Name="WideLayout">
57+ <VisualState.StateTriggers>
58+ <AdaptiveTrigger MinWindowWidth="{StaticResource Breakpoint640Plus}" />
59+ </VisualState.StateTriggers>
60+ <VisualState.Setters>
61+ <Setter Target="seeAlsoPanel.Width" Value="Auto" />
62+ <Setter Target="seeAlsoPanel.(Grid.Row)" Value="3" />
63+ <Setter Target="seeAlsoPanel.(Grid.Column)" Value="0" />
64+ <Setter Target="seeAlsoPanel.(Grid.ColumnSpan)" Value="3" />
65+
66+ <Setter Target="SourcePanel.(Grid.ColumnSpan)" Value="1" />
67+
68+ <Setter Target="DocumentationPanel.(Grid.ColumnSpan)" Value="1" />
69+
70+ <Setter Target="RelatedControlsPanel.(Grid.Row)" Value="0" />
71+ <Setter Target="RelatedControlsPanel.(Grid.Column)" Value="2" />
72+ <Setter Target="RelatedControlsPanel.(Grid.ColumnSpan)" Value="1" />
73+
74+ <Setter Target="FeedbackPanel.(Grid.Row)" Value="1" />
75+ <Setter Target="FeedbackPanel.(Grid.Column)" Value="2" />
76+ <Setter Target="FeedbackPanel.(Grid.ColumnSpan)" Value="1" />
77+ </VisualState.Setters>
78+ </VisualState>
79+ <VisualState x:Name="NarrowLayout">
80+ <VisualState.StateTriggers>
81+ <AdaptiveTrigger MinWindowWidth="0" />
82+ </VisualState.StateTriggers>
83+ <VisualState.Setters>
84+ <Setter Target="seeAlsoPanel.Width" Value="Auto" />
85+ <Setter Target="seeAlsoPanel.(Grid.Row)" Value="3" />
86+ <Setter Target="seeAlsoPanel.(Grid.Column)" Value="0" />
87+ <Setter Target="seeAlsoPanel.(Grid.ColumnSpan)" Value="3" />
88+
89+ <Setter Target="SourcePanel.(Grid.ColumnSpan)" Value="1" />
90+
91+ <Setter Target="DocumentationPanel.(Grid.ColumnSpan)" Value="1" />
92+
93+ <Setter Target="RelatedControlsPanel.(Grid.Row)" Value="0" />
94+ <Setter Target="RelatedControlsPanel.(Grid.Column)" Value="2" />
95+ <Setter Target="RelatedControlsPanel.(Grid.ColumnSpan)" Value="1" />
96+
97+ <Setter Target="FeedbackPanel.(Grid.Row)" Value="1" />
98+ <Setter Target="FeedbackPanel.(Grid.Column)" Value="2" />
99+ <Setter Target="FeedbackPanel.(Grid.ColumnSpan)" Value="1" />
100+
101+ <Setter Target="rightMargin.Width" Value="0" />
102+ <Setter Target="contentRoot.Padding" Value="14,0" />
103+ </VisualState.Setters>
104+ </VisualState>
105+ </VisualStateGroup>
106+ </VisualStateManager.VisualStateGroups>
107+
108+ <!-- Content Region -->
109+ <ScrollViewer
110+ x:Name="svPanel"
111+
112+ VerticalScrollBarVisibility="Auto"
113+ VerticalScrollMode="Auto">
114+ <Grid x:Name="contentRoot" Padding="24,0,0,0" SizeChanged="OnContentRootSizeChanged">
115+ <Grid.ColumnDefinitions>
116+ <ColumnDefinition x:Name="contentColumn" />
117+ <ColumnDefinition x:Name="rightMargin" Width="20" />
118+ <ColumnDefinition x:Name="infoColumn" Width="Auto" />
119+ </Grid.ColumnDefinitions>
120+ <Grid.RowDefinitions>
121+ <RowDefinition Height="Auto" />
122+ <RowDefinition Height="*" />
123+ <RowDefinition Height="20" />
124+ <RowDefinition Height="Auto" />
125+ </Grid.RowDefinitions>
126+
127+ <TextBlock
128+ x:Name="descriptionText"
129+ Style="{ThemeResource BodyTextBlockStyle}"
130+ Grid.ColumnSpan="2"
131+ Margin="0,5,24,0"
132+ Text="{x:Bind Item.Description}" />
133+
134+ <Frame x:Name="contentFrame" Grid.Row="1" />
135+
136+ <Grid
137+ x:Name="seeAlsoPanel"
138+ Grid.Row="0"
139+ Grid.RowSpan="2"
140+ Grid.Column="2"
141+ Width="280"
142+ Margin="0,0,24,24">
143+ <Grid.RowDefinitions>
144+ <RowDefinition Height="Auto" />
145+ <RowDefinition Height="Auto" />
146+ <RowDefinition Height="Auto" />
147+ <RowDefinition Height="Auto" />
148+ </Grid.RowDefinitions>
149+ <Grid.ColumnDefinitions>
150+ <ColumnDefinition />
151+ <ColumnDefinition Width="20" />
152+ <ColumnDefinition />
153+ </Grid.ColumnDefinitions>
154+
155+ <StackPanel x:Name="SourcePanel" Grid.Row="0" Grid.ColumnSpan="3" Margin="0,0,0,40">
156+ <TextBlock
157+ x:Name="SourceHeader"
158+ x:Uid="SourceHeader"
159+ Style="{ThemeResource SubtitleTextBlockStyle}"
160+ Text="View page code on GitHub"/>
161+ <HyperlinkButton
162+ x:Name="PageMarkupGitHubLink"
163+ ToolTipService.ToolTip="{x:Bind PageMarkupGitHubLink.NavigateUri, Mode=OneWay}">
164+ <TextBlock Text="XAML source code"/>
165+ </HyperlinkButton>
166+ <HyperlinkButton
167+ x:Name="PageCodeGitHubLink"
168+ ToolTipService.ToolTip="{x:Bind PageCodeGitHubLink.NavigateUri, Mode=OneWay}"
169+ Margin="0,12,0,0">
170+ <TextBlock Text="C# source code"/>
171+ </HyperlinkButton>
172+ </StackPanel>
173+
174+ <StackPanel x:Name="DocumentationPanel" Grid.Row="1" Grid.ColumnSpan="3" Margin="0,0,0,40">
175+ <TextBlock
176+ x:Name="docHeader"
177+ x:Uid="DocHeader"
178+ Style="{StaticResource SubtitleTextBlockStyle}" />
179+ <ItemsControl
180+ x:Name="DocsList"
181+ Margin="0,12,0,0"
182+ IsTabStop="False"
183+ ItemsSource="{x:Bind Item.Docs}">
184+ <ItemsControl.ItemsPanel>
185+ <ItemsPanelTemplate>
186+ <StackPanel Orientation="Vertical" />
187+ </ItemsPanelTemplate>
188+ </ItemsControl.ItemsPanel>
189+ <ItemsControl.ItemTemplate>
190+ <DataTemplate x:DataType="data:ControlInfoDocLink">
191+ <HyperlinkButton NavigateUri="{Binding Uri}" ToolTipService.ToolTip="{Binding Uri}">
192+ <TextBlock Text="{x:Bind Title}" />
193+ </HyperlinkButton>
194+ </DataTemplate>
195+ </ItemsControl.ItemTemplate>
196+ </ItemsControl>
197+ </StackPanel>
198+
199+ <StackPanel x:Name="RelatedControlsPanel" Grid.Row="2" Grid.ColumnSpan="3" Margin="0,0,0,40">
200+ <TextBlock
201+ x:Name="relatedControlsHeader"
202+ x:Uid="RelatedControlsHeader"
203+ Style="{StaticResource SubtitleTextBlockStyle}" />
204+
205+ <ItemsControl
206+ x:Name="relatedItemsControl"
207+ Margin="0,12,0,0"
208+ IsTabStop="False"
209+ ItemsSource="{x:Bind Item.RelatedControls}">
210+ <ItemsControl.ItemsPanel>
211+ <ItemsPanelTemplate>
212+ <StackPanel Orientation="Vertical" />
213+ </ItemsPanelTemplate>
214+ </ItemsControl.ItemsPanel>
215+ <ItemsControl.ItemTemplate>
216+ <DataTemplate x:DataType="x:String">
217+ <!-- A HyperlinkButton must always provide an accessible name to a screen reader which
218+ conveys the purpose of the link. By default, when the HyperlinkButton is built
219+ as below, with an Image and TextBlock, the HyperlinkButton provides no accessible
220+ name. So bind the accessible name to the same data that provides the text shown
221+ visually on the contained TextBlock. -->
222+ <HyperlinkButton AutomationProperties.Name="{x:Bind}" Click="OnRelatedControlClick">
223+ <RelativePanel>
224+ <!-- Now that the HyperlinkButton has a helpful accessible name, it serves no
225+ useful purpose for the contained Image, (which is purely decorative,) or
226+ the contained TextBlock to be exposed to a screen reader. All the information
227+ required by customers using a screen reader is accessible directly through the
228+ Hyperlink button. As such, mark the contained elements as not being interesting
229+ to a screen reader through use of the AutomationProperties.AccessibilityView
230+ property. -->
231+ <Image
232+ AutomationProperties.AccessibilityView="Raw"
233+ x:Name="iconImage"
234+ Width="25"
235+ Margin="0,0,15,0"
236+ common:ImageLoader.Source="{Binding}" />
237+ <TextBlock
238+ AutomationProperties.AccessibilityView="Raw"
239+ Foreground="{ThemeResource HyperlinkButtonForeground}"
240+ RelativePanel.RightOf="iconImage"
241+ Text="{x:Bind}"
242+ TextWrapping="Wrap" />
243+ </RelativePanel>
244+ </HyperlinkButton>
245+ </DataTemplate>
246+ </ItemsControl.ItemTemplate>
247+ </ItemsControl>
248+ </StackPanel>
249+
250+ <StackPanel x:Name="FeedbackPanel" Grid.Row="3" Grid.ColumnSpan="3">
251+ <TextBlock
252+ x:Name="feedbackHeader"
253+ x:Uid="FeedbackHeader"
254+ Style="{StaticResource SubtitleTextBlockStyle}" />
255+ <HyperlinkButton NavigateUri="https://github.com/microsoft/Xaml-Controls-Gallery/issues/new/choose"
256+ ToolTipService.ToolTip="https://github.com/microsoft/Xaml-Controls-Gallery/issues/new/choose">
257+ <TextBlock x:Uid="FeedbackLink" />
258+ </HyperlinkButton>
259+ </StackPanel>
260+ </Grid>
261+ </Grid>
262+ </ScrollViewer>
263+ </Grid>
264+</Page>
tests/syntax-tests/source/XAML/LICENSE.mdnew file+23
@@ -0,0 +1,23 @@
1+The `ItemPage.xaml` file has been added from https://github.com/microsoft/Xaml-Controls-Gallery under the following license:
2+
3+ MIT License
4+
5+ Copyright (c) Microsoft Corporation. All rights reserved.
6+
7+ Permission is hereby granted, free of charge, to any person obtaining a copy
8+ of this software and associated documentation files (the "Software"), to deal
9+ in the Software without restriction, including without limitation the rights
10+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+ copies of the Software, and to permit persons to whom the Software is
12+ furnished to do so, subject to the following conditions:
13+
14+ The above copyright notice and this permission notice shall be included in all
15+ copies or substantial portions of the Software.
16+
17+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+ SOFTWARE