Click here to Skip to main content
15,895,746 members
Articles / Desktop Programming / WPF

200% Reflective Class Diagram Creation Tool

Rate me:
Please Sign up or sign in to vote.
4.92/5 (200 votes)
20 Feb 2014CPOL22 min read 587.5K   11.5K   437  
WPF: Version II of my 100% Reflective class diagram creation tool.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		            xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
		            xmlns:grayScale="clr-namespace:GrayscaleEffect;assembly=GrayscaleEffect"
                    xmlns:local="clr-namespace:AutoDiagrammer">


    <Style x:Key="SimpleImageButtonStyle" TargetType="{x:Type ButtonBase}">
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ButtonBase">

                    <Image x:Name="img" 
                           Width="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Width}"
                           Height="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Height}"
                           Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Tag}"
                           Stretch="Fill"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="img" Property="Effect">
                                <Setter.Value>
                                    <grayScale:GrayscaleEffect/>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="GenericExpanderDownHeaderStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Border Padding="0" Background="SteelBlue" Margin="0" MinHeight="35" Height="35" >
                        <Grid Background="SteelBlue" SnapsToDevicePixels="False">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                            <Grid Margin="5,0,0,0">
                                <Ellipse x:Name="circle" HorizontalAlignment="Center" Height="19" 
											 Stroke="Black" Fill="#ffdddddd"  VerticalAlignment="Center" Width="19"/>
                                <Path x:Name="arrow" Data="M 1,1.5 L 4.5,5 L 8,1.5" 
										  HorizontalAlignment="Center" SnapsToDevicePixels="false" 
										  Stroke="Black" StrokeThickness="2" VerticalAlignment="Center"/>
                            </Grid>
                            <ContentPresenter Grid.Column="1" HorizontalAlignment="Left" Margin="10,0,0,0" 
												  RecognizesAccessKey="True" SnapsToDevicePixels="True" 
												  Content="{TemplateBinding Content}"
												  VerticalAlignment="Center" 
												  TextElement.Foreground="#ffdddddd"
												  TextElement.FontSize="12" TextElement.FontFamily="Verdana" 
												  TextElement.FontWeight="Bold"/>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="true">
                            <Setter Property="Data" TargetName="arrow" Value="M 1,4.5  L 4.5,1  L 8,4.5"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter Property="Stroke" TargetName="circle" Value="SteelBlue"/>
                            <Setter Property="Stroke" TargetName="arrow" Value="SteelBlue"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    <Style x:Key="GenericExpanderStyle" TargetType="{x:Type Expander}">
        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
        <Setter Property="Background" Value="White"/>
        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
        <Setter Property="Margin" Value="0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Expander}">
                    <DockPanel>
                        <ToggleButton x:Name="HeaderSite" ContentTemplate="{TemplateBinding HeaderTemplate}" ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}" Content="{TemplateBinding Header}" DockPanel.Dock="Top" Foreground="{TemplateBinding Foreground}" FontWeight="{TemplateBinding FontWeight}" 
								FocusVisualStyle="{x:Null}" FontStyle="{TemplateBinding FontStyle}" FontStretch="{TemplateBinding FontStretch}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" 
											IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0" MinWidth="0" MinHeight="0" Padding="0" Style="{StaticResource GenericExpanderDownHeaderStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        <ContentPresenter x:Name="ExpandSite" DockPanel.Dock="Bottom" 
											  Focusable="false" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    </DockPanel>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsExpanded" Value="true">
                            <Setter Property="Visibility" TargetName="ExpandSite" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>


    
    <DataTemplate x:Key="MethodItemTemplate">
        <Grid HorizontalAlignment="Stretch">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="40"/>
            </Grid.ColumnDefinitions>

            <Label Grid.Column="0"  Content="{Binding MethodName}" Foreground="Black"/>
            <Button Grid.Column="1" Tag="../Images/mag.png" 
                    Style="{StaticResource SimpleImageButtonStyle}" 
                    ToolTip="Show Method Body IL" Width="15" Height="15" 
                    VerticalAlignment="Center" VerticalContentAlignment="Center"
                    HorizontalAlignment="Center" HorizontalContentAlignment="Right"
                    Margin="5" Command="{Binding ShowMethodBodyCommand}"/>
        </Grid>
    </DataTemplate>


    <DataTemplate x:Key="TransparentTemplate">
        <Label Content="{Binding}" Foreground="Black"/>
    </DataTemplate>


    <Style x:Key="TransparentListBoxItemStyle" TargetType="{x:Type ListBoxItem}">
        <Style.Resources>
            <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}"
                             Color="Transparent"/>
        </Style.Resources>
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
    </Style>


    <Style x:Key="TransparentListBoxStyle" TargetType="{x:Type ListBox}">
        <Setter Property="ItemContainerStyle" Value="{StaticResource TransparentListBoxItemStyle}"/>
        <Setter Property="ItemTemplate" Value="{StaticResource TransparentTemplate}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="Foreground" Value="Black"/>
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
        <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
        <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
        <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="1" SnapsToDevicePixels="true">
                        <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}" 
                                          Background="Transparent" >
                            <ItemsPresenter
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                        </ScrollViewer>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsGrouping" Value="true">
                            <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <Style x:Key="HyperLinkLabelStyle" TargetType="{x:Type Label}">
        <Setter Property="Foreground" Value="SteelBlue"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
        <Setter Property="VerticalContentAlignment" Value="Top"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Label}">
                    <TextBlock x:Name="txt" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
								Text="{TemplateBinding Content}"
								SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" 
								VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="true">
                            <Setter TargetName="txt" Property="TextDecorations" Value="Underline"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>



    <!-- ScrollBarPageButton -->
    <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="{DynamicResource transparentBackGround}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- VerticalScrolScrollBarThumblBar -->
    <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border 
                        CornerRadius="0" 
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="1" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- VerticalScrollBar -->
    <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Background="{DynamicResource transparentBackGround}" >
            <Grid.RowDefinitions>
                <RowDefinition Height="0.00001*"/>
            </Grid.RowDefinitions>
            <Border
              Grid.RowSpan="1"
              CornerRadius="0" 
              Background="{DynamicResource transparentBackGround}" />
            <Track
              Name="PART_Track"
              Grid.Row="1"
              IsDirectionReversed="true">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
                      Style="{StaticResource ScrollBarPageButton}"
                      Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Name="thumb"
                      Style="{StaticResource ScrollBarThumb}" 
                      Margin="3,0,3,0"  
                      Background="SteelBlue"
                      BorderBrush="SteelBlue" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
                      Style="{StaticResource ScrollBarPageButton}"
                      Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>

            </Track>
        </Grid>
    </ControlTemplate>

    <!-- HorizontalScrollBar -->
    <ControlTemplate x:Key="HorizontalScrollBar" TargetType="{x:Type ScrollBar}">
        <Grid Background="{DynamicResource transparentBackGround}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.00001*"/>
            </Grid.ColumnDefinitions>
            <Border
              Grid.ColumnSpan="1"
              CornerRadius="0" 
              Background="{DynamicResource transparentBackGround}" />
            <Track 
                  Name="PART_Track"
                  Grid.Column="1"
                  IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                    <RepeatButton 
                      Style="{StaticResource ScrollBarPageButton}"
                      Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Name="thumb"
                      Style="{StaticResource ScrollBarThumb}" 
                      Margin="0,3,0,3"  
                      Background="SteelBlue"
                      BorderBrush="SteelBlue" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
                      Style="{StaticResource ScrollBarPageButton}"
                      Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
        </Grid>
    </ControlTemplate>

    <!-- ScrollBar -->
    <Style TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="14" />
                <Setter Property="Template" Value="{StaticResource HorizontalScrollBar}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="14"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{StaticResource VerticalScrollBar}" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <!-- ScrollViewerStyle -->
    <Style TargetType="{x:Type ScrollViewer}">
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="HorizontalScrollBarVisibility" Value="Visible" />
        <Setter Property="VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="ContextMenu" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*"/>
                            <ColumnDefinition Width="Auto"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="*"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>

                        <ScrollContentPresenter Grid.Column="0"/>

                        <ScrollBar Name="PART_VerticalScrollBar"
                            Grid.Column="1"
                            Value="{TemplateBinding VerticalOffset}"
                            Maximum="{TemplateBinding ScrollableHeight}"
                            ViewportSize="{TemplateBinding ViewportHeight}"
                            Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"/>
                        <ScrollBar Name="PART_HorizontalScrollBar"
                            Orientation="Horizontal"
                            Grid.Row="1"
                            Grid.Column="0"
                            Value="{TemplateBinding HorizontalOffset}"
                            Maximum="{TemplateBinding ScrollableWidth}"
                            ViewportSize="{TemplateBinding ViewportWidth}"
                            Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>




    <!-- Application ToolTip Styles -->
    <Style TargetType="ToolTip">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="HasDropShadow" Value="True"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolTip">
                    <Border Name="Border"
                          CornerRadius="2"
                          BorderBrush="Black"
                          Background="#ffdddddd"
                          BorderThickness="2"
                          Width="{TemplateBinding Width}"
                          Height="{TemplateBinding Height}">

                        <Label Foreground="Black" FontFamily="Tahoma"
                            FontWeight="Bold" FontSize="10"
                            Margin="2" Content="{TemplateBinding Content}"
                            HorizontalAlignment="Left"
                            VerticalAlignment="Top" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasDropShadow" Value="true">
                            <Setter TargetName="Border" 
                                    Property="CornerRadius" 
                                    Value="4"/>
                            <Setter TargetName="Border" 
                                    Property="SnapsToDevicePixels" 
                                    Value="true"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>









    <!-- TextBoxes-->
    <Style x:Key="ValidatingTextBox" TargetType="{x:Type TextBoxBase}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
        <Setter Property="MinWidth" Value="120"/>
        <Setter Property="MinHeight" Value="20"/>
        <Setter Property="AllowDrop" Value="true"/>
        <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TextBoxBase}">
                    <Border 
                          Name="Border"
                          CornerRadius="0" 
                          Padding="0"
                          Background="White"
                          BorderBrush="Black"
                          BorderThickness="1" >
                        <ScrollViewer Margin="0" x:Name="PART_ContentHost"
                                      VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="LightGray"/>
                            <Setter TargetName="Border" Property="BorderBrush" Value="Black"/>
                            <Setter Property="Foreground" Value="Gray"/>
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="true">
                            <Setter TargetName="Border" Property="BorderBrush" 
                                    Value="Red"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Validation.HasError" Value="true">
                <Setter Property="ToolTip"
                            Value="{Binding RelativeSource={x:Static RelativeSource.Self},
                            Path=(Validation.Errors).CurrentItem.ErrorContent}"/>
            </Trigger>
        </Style.Triggers>
    </Style>


    <Style x:Key="GridSplitterPreviewStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Rectangle Fill="#FFDDDDDD" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="GridSplitterButtonStyle"
			   TargetType="{x:Type Button}">
        <Setter Property="FocusVisualStyle"
					Value="{x:Null}" />
        <Setter Property="Background"
					Value="#FFDDDDDD" />
        <Setter Property="BorderBrush"
					Value="#FFDDDDDD" />
        <Setter Property="BorderThickness"
					Value="1" />
        <Setter Property="Foreground"
					Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
        <Setter Property="HorizontalContentAlignment"
					Value="Stretch" />
        <Setter Property="VerticalContentAlignment"
					Value="Stretch" />
        <Setter Property="Padding"
					Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid>
                        <Ellipse Fill="{TemplateBinding Background}"
                                     Width="15" Height="15"
                                     Stroke="{TemplateBinding BorderBrush}"
                                     StrokeThickness="{TemplateBinding BorderThickness}"
                                     HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
								    Margin="{TemplateBinding Padding}"
								    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                        <ContentPresenter RecognizesAccessKey="True" Margin="3"
											  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />

                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsKeyboardFocused"
									 Value="true" />
                        <Trigger Property="ToggleButton.IsChecked"
									 Value="true" />
                        <Trigger Property="IsEnabled"
									 Value="false">
                            <Setter Property="Foreground"
										Value="#ADADAD" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="CollapsibleGridSplitterStyle"
			   TargetType="{x:Type GridSplitter}">
        <Setter Property="Background"
					Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
        <Setter Property="PreviewStyle"
					Value="{StaticResource GridSplitterPreviewStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type GridSplitter}">
                    <Border BorderBrush="{TemplateBinding BorderBrush}"
								BorderThickness="{TemplateBinding BorderThickness}"
								Background="{TemplateBinding Background}">
                        <Grid Height="Auto">
                            <StackPanel x:Name="ColumnsCollapsers"
											VerticalAlignment="Stretch">
                                <Button Height="20"
											Margin="3"
											Padding="0"
											Style="{DynamicResource GridSplitterButtonStyle}"
											RenderTransformOrigin="0.5,0.5"
											Cursor="Arrow">
                                    <Button.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleY="1"
																ScaleX="-1" />
                                            <SkewTransform AngleY="0"
															   AngleX="0" />
                                            <RotateTransform Angle="0" />
                                            <TranslateTransform />
                                        </TransformGroup>
                                    </Button.RenderTransform>
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <local:CollapseAction />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                    <Path Data="M20.500334,30.5 L20.500334,49.166667 35.500332,38.833333 z"
											  Fill="Black"
											  HorizontalAlignment="Center"
											  Height="6"
											  Margin="0"
											  Stretch="Fill"
											  Stroke="{x:Null}"
											  Width="6"
											  StrokeThickness="0"
											  VerticalAlignment="Center" />
                                </Button>
                                <Button Height="20"
											Margin="3"
											Padding="0"
											Style="{DynamicResource GridSplitterButtonStyle}"
											Cursor="Arrow">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <local:CollapseAction Direction="Right" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                    <Path Data="M6.4035191E-08,0 L-1.5987212E-14,5.9999996 5.9999999,2.6785712 z"
											  Fill="Black"
											  HorizontalAlignment="Center"
											  Height="6"
											  Margin="0"
											  Stroke="{x:Null}"
											  Width="6"
											  StrokeThickness="0"
											  VerticalAlignment="Center"
											  StrokeLineJoin="Round"
											  Stretch="Fill" />
                                </Button>
                            </StackPanel>
                            <StackPanel x:Name="RowCollapsers"
											VerticalAlignment="Stretch"
											Orientation="Horizontal"
											Visibility="Collapsed">
                                <Button Height="20"
											Padding="0"
											Style="{DynamicResource GridSplitterButtonStyle}"
											RenderTransformOrigin="0.5,0.5"
											Cursor="Arrow"
											Width="10"
											HorizontalAlignment="Left"
											Margin="3">
                                    <Button.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleY="1"
																ScaleX="-1" />
                                            <SkewTransform AngleY="0"
															   AngleX="0" />
                                            <RotateTransform Angle="90" />
                                            <TranslateTransform />
                                        </TransformGroup>
                                    </Button.RenderTransform>
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <local:CollapseAction Direction="Top" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                    <Path Data="M20.500334,30.5 L20.500334,49.166667 35.500332,38.833333 z"
											  Fill="Black"
											  HorizontalAlignment="Center"
											  Height="6"
											  Margin="0"
											  Stretch="Fill"
											  Stroke="{x:Null}"
											  Width="6"
											  StrokeThickness="0"
											  VerticalAlignment="Center" />
                                </Button>
                                <Button Height="20"
											Padding="0"
											Style="{DynamicResource GridSplitterButtonStyle}"
											Cursor="Arrow"
											Width="10"
											HorizontalAlignment="Left"
											Margin="3"
											RenderTransformOrigin="0.5,0.5">
                                    <Button.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform />
                                            <SkewTransform />
                                            <RotateTransform Angle="90" />
                                            <TranslateTransform />
                                        </TransformGroup>
                                    </Button.RenderTransform>
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <local:CollapseAction Direction="Bottom" />
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                    <Path Data="M6.4035191E-08,0 L-1.5987212E-14,5.9999996 5.9999999,2.6785712 z"
											  Fill="Black"
											  HorizontalAlignment="Center"
											  Height="6"
											  Margin="0"
											  Stroke="{x:Null}"
											  Width="6"
											  StrokeThickness="0"
											  VerticalAlignment="Center"
											  StrokeLineJoin="Round"
											  Stretch="Fill" />
                                </Button>
                            </StackPanel>
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="ResizeDirection"
									 Value="Rows">
                            <Setter Property="Visibility"
										TargetName="ColumnsCollapsers"
										Value="Collapsed" />
                            <Setter Property="Visibility"
										TargetName="RowCollapsers"
										Value="Visible" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>





</ResourceDictionary>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United Kingdom United Kingdom
I currently hold the following qualifications (amongst others, I also studied Music Technology and Electronics, for my sins)

- MSc (Passed with distinctions), in Information Technology for E-Commerce
- BSc Hons (1st class) in Computer Science & Artificial Intelligence

Both of these at Sussex University UK.

Award(s)

I am lucky enough to have won a few awards for Zany Crazy code articles over the years

  • Microsoft C# MVP 2016
  • Codeproject MVP 2016
  • Microsoft C# MVP 2015
  • Codeproject MVP 2015
  • Microsoft C# MVP 2014
  • Codeproject MVP 2014
  • Microsoft C# MVP 2013
  • Codeproject MVP 2013
  • Microsoft C# MVP 2012
  • Codeproject MVP 2012
  • Microsoft C# MVP 2011
  • Codeproject MVP 2011
  • Microsoft C# MVP 2010
  • Codeproject MVP 2010
  • Microsoft C# MVP 2009
  • Codeproject MVP 2009
  • Microsoft C# MVP 2008
  • Codeproject MVP 2008
  • And numerous codeproject awards which you can see over at my blog

Comments and Discussions