Created
June 3, 2013 10:04
-
-
Save hoehrmann/5697253 to your computer and use it in GitHub Desktop.
XAML ListBox bound to the output of the W3C Markup Validator. Originally http://lists.w3.org/Archives/Public/www-archive/2005Aug/0000.html (which also has a screenshot of the code in XamlPad).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Border xmlns="http://schemas.microsoft.com/winfx/avalon/2005" xmlns:x="http://schemas.microsoft.com/winfx/xaml/2005"> | |
<Grid> | |
<Grid.Resources> | |
<XmlDataSource x:Key="ValidatorData" Source="http://validator.w3.org/check?uri=http://www.google.com&output=xml" XPath="result/messages/msg[position() < 20]"/> | |
<DataTemplate x:Key="ValidatorDataTemplate"> | |
<Grid> | |
<ColumnDefinition Width="Auto" SharedSizeGroup="MessageLine" /> | |
<ColumnDefinition Width="Auto" SharedSizeGroup="MessageColumn" /> | |
<ColumnDefinition Width="*" SharedSizeGroup="MessageText" /> | |
<TextBlock Grid.Column="0" Margin="5,0,5,0" TextContent="{Binding XPath=@line}" /> | |
<TextBlock Grid.Column="1" Margin="5,0,5,0" TextContent="{Binding XPath=@col}" /> | |
<TextBlock Grid.Column="3" Margin="5,0,5,0" TextContent="{Binding XPath=.}" /> | |
</Grid> | |
</DataTemplate> | |
</Grid.Resources> | |
<ListBox ItemsSource="{Binding Source={StaticResource ValidatorData}}" ItemTemplate="{StaticResource ValidatorDataTemplate}"> | |
<ListBox.Template> | |
<ControlTemplate> | |
<Grid Grid.IsSharedSizeScope="true"> | |
<RowDefinition Height="Auto" /> | |
<DockPanel> | |
<Grid DockPanel.Dock="top"> | |
<ColumnDefinition Width="Auto" SharedSizeGroup="MessageLine" /> | |
<ColumnDefinition Width="Auto" SharedSizeGroup="MessageColumn" /> | |
<ColumnDefinition Width="*" SharedSizeGroup="MessageText" /> | |
</Grid> | |
<StackPanel IsItemsHost="true" /> | |
</DockPanel> | |
</Grid> | |
</ControlTemplate> | |
</ListBox.Template> | |
</ListBox> | |
</Grid> | |
</Border> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment