Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

WPF Diagram Designer - Part 3

, 29 Feb 2008 CPOL
Connecting items
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:s="clr-namespace:DiagramDesigner"
                    xmlns:c="clr-namespace:DiagramDesigner.Controls">

  <RadialGradientBrush x:Key="RadialBrushOrange" Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
    <GradientStop Color="White" Offset="0"/>
    <GradientStop Color="Orange" Offset="0.9"/>
  </RadialGradientBrush>

  <RadialGradientBrush x:Key="RadialBrushGreen" Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
    <GradientStop Color="White" Offset="0"/>
    <GradientStop Color="Green" Offset="0.9"/>
  </RadialGradientBrush>

  <RadialGradientBrush x:Key="RadialBrushBlue" Center="0.2, 0.2" GradientOrigin="0.2, 0.2" RadiusX="0.8" RadiusY="0.8">
    <GradientStop Color="White" Offset="0"/>
    <GradientStop Color="Blue" Offset="0.9"/>
  </RadialGradientBrush>
  
  <LinearGradientBrush x:Key="Brush6" StartPoint="0,0" EndPoint="0,1" Opacity="1">
    <LinearGradientBrush.GradientStops>
      <GradientStop Color="#FAFBE9" Offset="0.1" />
      <GradientStop Color="Orange" Offset="1" />
    </LinearGradientBrush.GradientStops>
  </LinearGradientBrush>

  <s:Toolbox x:Key="ShapeStencils" ItemSize="60,60">
    <ItemsControl.Items>

      <Ellipse Fill="{StaticResource RadialBrushOrange}" ToolTip="Ellipse" IsHitTestVisible="false">
        <Ellipse.BitmapEffect>
          <DropShadowBitmapEffect Color="Gray" Direction="315" ShadowDepth="15" Softness="0.8" Opacity="0.4"/>
        </Ellipse.BitmapEffect>
      </Ellipse>

      <Ellipse Fill="{StaticResource RadialBrushBlue}" ToolTip="Ellipse" IsHitTestVisible="false">
        <Ellipse.BitmapEffect>
          <DropShadowBitmapEffect Color="Gray" Direction="315" ShadowDepth="15" Softness="0.8" Opacity="0.4"/>
        </Ellipse.BitmapEffect>
      </Ellipse>

      <Ellipse Fill="{StaticResource RadialBrushGreen}" ToolTip="Ellipse" IsHitTestVisible="false">
        <Ellipse.BitmapEffect>
          <DropShadowBitmapEffect Color="Gray" Direction="315" ShadowDepth="15" Softness="0.8" Opacity="0.4"/>
        </Ellipse.BitmapEffect>
      </Ellipse>

      <Path Stretch="Fill" IsHitTestVisible="false"
            StrokeLineJoin="Round"
            Fill="{StaticResource Brush6}"
            Stroke="#AAFF8C00"
            StrokeThickness="3"
            Data="M 9,2 11,7 17,7 12,10 14,15 9,12 4,15 6,10 1,7 7,7 Z">
        <s:DesignerItem.DragThumbTemplate>
          <ControlTemplate>
            <Path Fill="Transparent" Stretch="Fill" Data="M 9,2 11,7 17,7 12,10 14,15 9,12 4,15 6,10 1,7 7,7 Z"/>
          </ControlTemplate>
        </s:DesignerItem.DragThumbTemplate>
        <s:DesignerItem.ConnectorDecoratorTemplate>
          <ControlTemplate>
            <c:RelativePositionPanel Margin="-4">
              <s:Connector Orientation="Top" c:RelativePositionPanel.RelativePosition="0.5,0"/>
              <s:Connector Orientation="Left" c:RelativePositionPanel.RelativePosition="0,0.385"/>
              <s:Connector Orientation="Right" c:RelativePositionPanel.RelativePosition="1,0.385"/>
              <s:Connector Orientation="Bottom" c:RelativePositionPanel.RelativePosition="0.185,1"/>
              <s:Connector Orientation="Bottom" c:RelativePositionPanel.RelativePosition="0.815,1"/>
            </c:RelativePositionPanel>
          </ControlTemplate>
        </s:DesignerItem.ConnectorDecoratorTemplate>
      </Path>
      
    </ItemsControl.Items>
  </s:Toolbox>     
</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)

Share

About the Author

sukram

Austria Austria
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 29 Feb 2008
Article Copyright 2008 by sukram
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid