Click here to Skip to main content
15,893,904 members
Articles / Desktop Programming / WPF

Reflection Studio - Part 1 - Introduction: Architecture and Design

Rate me:
Please Sign up or sign in to vote.
4.83/5 (23 votes)
22 Sep 2010GPL36 min read 60.1K   6.9K   111  
Reflection Studio is a "developer" application for assembly, database, performance, and code generation, written in C# under WPF 4.0.
<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ucc="clr-namespace:ReflectionStudio.Controls"
    >
    
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/ReflectionStudio.Controls;component/Resources/Controls/FrameButtons.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    
    <!--OFFICE STYLE WINDOW-->
    <Style x:Key="{x:Type ucc:OfficeWindow}" TargetType="{x:Type ucc:OfficeWindow}">
        <Setter Property="AllowsTransparency" Value="True"/>
        <Setter Property="WindowStyle" Value="None"/>
        <Setter Property="ResizeMode" Value="CanResizeWithGrip"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ucc:OfficeWindow}">
                    <AdornerDecorator>
                        <Border x:Name="PART_WindowBorder" CornerRadius="4"  Focusable="False"
                                Background="{DynamicResource WindowBackgroundBrush}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition/>
                                </Grid.RowDefinitions>

                                <Border Background="{DynamicResource WindowBackgroundBrush}"
                                        CornerRadius="5"
                                        VerticalAlignment="Stretch"
                                        BorderThickness="1"
                                        BorderBrush="Black"></Border>
                                
                                <!-- Drag container for the titlebar -->
                                <Control x:Name="PART_Titlebar" Grid.Row="0" Background="Transparent" Height="26"
                                        VerticalAlignment="Top" HorizontalAlignment="Stretch" Focusable="False"
                                        Panel.ZIndex="100" Margin="180,0,65,0">
                                        <Control.Template>
                                        <ControlTemplate>
                                            <Grid>
                                                <TextBlock
                                            Text="{Binding Title, RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type Window}}}" 
                                            HorizontalAlignment="Stretch" VerticalAlignment="Center" 
                                            Foreground="{DynamicResource WindowForegroundBrush}" Focusable="False" Margin="4"
                                            Visibility="Hidden"
                                            />
                                            </Grid>
                                            </ControlTemplate>
                                        </Control.Template>
                                </Control>

                                <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="0,2,5,0" VerticalAlignment="top"
                                            HorizontalAlignment="Right" Panel.ZIndex="100">
                                    <Button Width="18" Height="18" Style="{StaticResource minimizeButton}"
                                            x:Name="PART_Minimize" SnapsToDevicePixels="True" IsTabStop="False" Focusable="False">
                                    </Button>
                                    <Button Width="18" Height="18" Margin="2,0,0,0" IsTabStop="False" Focusable="False"
                                            Style="{StaticResource maximizeButton}" x:Name="PART_Maximize">
                                    </Button>
                                    <Button Width="18" Height="18" Margin="2,0,0,0" IsTabStop="False" Focusable="False"
                                            Style="{StaticResource closeButton}" x:Name="PART_Close">
                                    </Button>
                                </StackPanel>

                                <!-- Window content -->
                                <ContentPresenter Grid.Row="0" Margin="4"/>

                                <!-- Resize helpers -->
                                <Rectangle Grid.Row="0" Grid.Column="0" Fill="Transparent" HorizontalAlignment="Stretch" Focusable="False"
                                           VerticalAlignment="Top" Height="10" x:Name="PART_ResizeTop" Cursor="SizeNS"/>

                                <Rectangle Grid.Row="1" Grid.Column="0" Fill="Transparent" HorizontalAlignment="Stretch" Focusable="False"
                                           VerticalAlignment="Bottom" Height="10" x:Name="PART_ResizeBottom" Cursor="SizeNS"/>

                                <Rectangle Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Fill="Transparent" HorizontalAlignment="Left"
                                           VerticalAlignment="Stretch" Width="10" x:Name="PART_ResizeLeft" Cursor="SizeWE" Focusable="False"/>

                                <Rectangle Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" Fill="Transparent" HorizontalAlignment="Right"
                                           VerticalAlignment="Stretch" Width="10" x:Name="PART_ResizeRight" Cursor="SizeWE" Focusable="False"/>

                                <ResizeGrip Grid.Row="1" Grid.Column="0" HorizontalAlignment="Right" 
                                           VerticalAlignment="Bottom" Width="17" Height="17" Focusable="False" Margin="0,0,2,2"
                                           x:Name="PART_ResizeGrip" Cursor="SizeNWSE"/>
                            </Grid>
                        </Border>
                    </AdornerDecorator>
                    <ControlTemplate.Triggers>
                        <Trigger Property="WindowState" Value="Maximized">
                            <Setter Property="CornerRadius" TargetName="PART_WindowBorder" Value="0"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="CanMinimize">
                            <Setter TargetName="PART_Maximize" Property="IsEnabled" Value="False"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="CanMinimize">
                            <Setter TargetName="PART_Maximize" Property="IsEnabled" Value="False"/>
                        </Trigger>
                        <Trigger Property="ResizeMode" Value="NoResize">
                            <Setter TargetName="PART_Maximize" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_Minimize" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ResizeLeft" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ResizeBottom" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ResizeTop" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ResizeRight" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ResizeGrip" Property="Visibility" Value="Collapsed"/>
                        </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 GNU General Public License (GPLv3)


Written By
Architect
France France
WPF and MVVM fan, I practice C # in all its forms from the beginning of the NET Framework without mentioning C ++ / MFC and other software packages such as databases, ASP, WCF, Web & Windows services, Application, and now Core and UWP.
In my wasted hours, I am guilty of having fathered C.B.R. and its cousins C.B.R. for WinRT and UWP on the Windows store.
But apart from that, I am a great handyman ... the house, a rocket stove to heat the jacuzzi and the last one: a wood oven for pizza, bread, and everything that goes inside

https://guillaumewaser.wordpress.com/
https://fouretcompagnie.wordpress.com/

Comments and Discussions