Click here to Skip to main content
12,303,543 members (76,419 online)
Click here to Skip to main content

Stats

234.2K views
15.9K downloads
309 bookmarked
Posted

WPF Diagram Designer - Part 2

, 8 Oct 2008 CPOL
Designer Canvas with Zoombox
<Window x:Class="DiagramDesigner.Window1"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s="clr-namespace:DiagramDesigner"
        WindowStartupLocation="CenterScreen"
        Title="Diagram Designer Part 2"
        FontFamily="SegoeUI"
        Height="850"
        Width="1100">
    <DockPanel Margin="0">
        <ToolBar Height="35"
                 DockPanel.Dock="Top">
            <Button ToolTip="New"
                    Margin="8,0,3,0"
                    Click="OnClickNew">
                <Button.Content>
                    <Image Stretch="Uniform"
                           Source="Images/newBold.png" />
                </Button.Content>
            </Button>
            <Button ToolTip="Rotate Right 90°"
                    Margin="8,0,3,0"
                    Click="OnClickRotateRight">
                <Button.Content>
                    <Image Stretch="Uniform"
                           Source="Images/rotateRight.png" />
                </Button.Content>
            </Button>
            <Button ToolTip="Rotate Left 90°"
                    Margin="8,0,3,0"
                    Click="OnClickRotateLeft">
                <Button.Content>
                    <Image Stretch="Uniform"
                           Source="Images/rotateLeft.png" />
                </Button.Content>
            </Button>
        </ToolBar>
        
        <Grid Margin="0,5,0,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="230" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Border Margin="3,1,0,0"
                    Grid.Column="1"
                    BorderBrush="LightGray"
                    BorderThickness="1">
                <Grid>
                    <ScrollViewer Name="DesignerScrollViewer"
                                  Background="Transparent"
                                  HorizontalScrollBarVisibility="Auto"
                                  VerticalScrollBarVisibility="Auto">
                        <s:DesignerCanvas x:Name="MyDesignerCanvas"
                                          MinHeight="800"
                                          MinWidth="1000"
                                          AllowDrop="True"
                                          Background="White">
                        </s:DesignerCanvas>
                    </ScrollViewer>
                    <s:ZoomBox Width="180"
                               HorizontalAlignment="Right"
                               VerticalAlignment="Top"
                               ScrollViewer="{Binding ElementName=DesignerScrollViewer}"
                               Margin="0,5,25,0" />
                </Grid>
            </Border>
            <Border Grid.Column="0"
                    BorderBrush="LightGray"
                    BorderThickness="1">
                <StackPanel>
                    <Expander IsExpanded="True"
                              Header="Symbols"
                              Margin="0,1,0,0"
                              Content="{StaticResource SymbolStencils}" />
                    <Expander IsExpanded="False"
                              Header="Flow Chart"
                              Margin="0,1,0,0"
                              Content="{StaticResource FlowChartSymbols}" />
                    <Expander IsExpanded="False"
                              Header="Regelungstechnik"
                              Margin="0,1,0,0"
                              Content="{StaticResource RegelungstechnikSymbole}" />
                    <!--<Expander Header="Basic Shapes"
                              Margin="0,1,0,0"
                              Content="{StaticResource BasicShapesStencils}" />-->

                </StackPanel>
            </Border>

            <GridSplitter Grid.Column="1"
                          HorizontalAlignment="Left"
                          VerticalAlignment="Stretch"
                          Background="Transparent"
                          Width="3" />
        </Grid>
    </DockPanel>
</Window>

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)

Share

About the Author

sukram
Austria Austria
No Biography provided

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160530.1 | Last Updated 8 Oct 2008
Article Copyright 2008 by sukram
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid