view SilverlightGlimpse/Controls/ExceptionsViewer.xaml @ 60:fc62c971a117

upload to blog
author Steven Hollidge <stevenhollidge@hotmail.com>
date Sat, 21 Apr 2012 21:19:39 +0100
parents 3591c26bd63e
children
line wrap: on
line source

<UserControl x:Class="SilverlightGlimpse.Controls.ExceptionsViewer"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid x:Name="LayoutRoot" Background="White">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="250" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <TextBlock Grid.ColumnSpan="2"
                   Margin="3.5"
                   VerticalAlignment="Center"
                   FontSize="18"
                   Foreground="Red"
                   Text="Exceptions Viewer" />

        <ListBox x:Name="lbExceptions"
                 Grid.Row="1"
                 Margin="3.5"
                 ItemsSource="{Binding}"
                 SelectionChanged="lbExceptions_SelectionChanged" />

        <ScrollViewer Grid.Row="1"
                      Grid.Column="1"
                      Margin="3.5"
                      DataContext="{Binding ElementName=lbExceptions,
                                            Path=SelectedItem}">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <Rectangle Fill="BlanchedAlmond" />
                <TextBlock x:Name="tbAction"
                           FontSize="14"
                           Text="Action"
                           TextDecorations="Underline" />
                <TextBlock Grid.Row="1"
                           FontSize="11"
                           Text="{Binding Path=Action}"
                           TextWrapping="Wrap"
                           Visibility="{Binding ElementName=tbAction,
                                                Path=Visibility}" />

                <Rectangle Grid.Row="2" Fill="BlanchedAlmond" />
                <TextBlock Grid.Row="2"
                           Margin="0,7,0,0"
                           FontSize="14"
                           Text="Control Name"
                           TextDecorations="Underline"
                           Visibility="{Binding ElementName=tbAction,
                                                Path=Visibility}" />
                <TextBlock Grid.Row="3"
                           FontSize="11"
                           Text="{Binding Path=ControlName}"
                           TextWrapping="Wrap"
                           Visibility="{Binding ElementName=tbAction,
                                                Path=Visibility}" />

                <Rectangle Grid.Row="4" Fill="BlanchedAlmond" />
                <TextBlock Grid.Row="4"
                           Margin="0,7,0,0"
                           FontSize="14"
                           Text="Message"
                           TextDecorations="Underline" />
                <TextBlock Grid.Row="5"
                           FontSize="11"
                           Text="{Binding Path=Exception.Message}"
                           TextWrapping="Wrap" />

                <Rectangle Grid.Row="6" Fill="BlanchedAlmond" />
                <TextBlock Grid.Row="6"
                           Margin="0,7,0,0"
                           FontSize="14"
                           Text="Stack Trace"
                           TextDecorations="Underline" />
                <TextBlock Grid.Row="7"
                           FontSize="11"
                           Text="{Binding Path=Exception.StackTrace}"
                           TextWrapping="Wrap" />

            </Grid>
        </ScrollViewer>
        <Button Grid.Row="2"
                Grid.Column="1"
                Margin="11"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Click="ClearExceptions_Click"
                Content="Clear Exceptions"
                Padding="7" />
    </Grid>
</UserControl>