Nested Canvas : WPF Shapes « WPF « ASP.Net






Nested Canvas

<Canvas xmlns="http://schemas.microsoft.com/client/2007"  
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   x:Name="rootCanvas">

  <Canvas Canvas.Top="30">
    <Rectangle MouseLeftButtonUp="startDownload"
      x:Name="Button1"
      Canvas.Left="20"
      Height="25" Width="50"
      Fill="Silver" />
    <TextBlock
      Canvas.Top ="5" Canvas.Left="30"
      Text="Add" FontSize="12" />
    
    <Rectangle MouseLeftButtonUp="clearTree"
      x:Name="Button2"
      Canvas.Left="80"
      Height="25" Width="50"
      Fill="Silver" />
    <TextBlock
      Canvas.Top ="5" Canvas.Left="90"
      Text="Clear" FontSize="12" />
  </Canvas>


  <Canvas Canvas.Left="5" Canvas.Top="70">
    <Ellipse Height="200" Width="200"
      Stroke="Black" StrokeThickness="10" Fill="Cyan">
      <Ellipse.OpacityMask>
        <LinearGradientBrush>
          <GradientStop Offset="0.25" Color="#00000000"/>
          <GradientStop Offset="1" Color="#FF000000"/>
        </LinearGradientBrush>
      </Ellipse.OpacityMask>
    </Ellipse>
  </Canvas>

  <Canvas x:Name="insertPoint" Canvas.Left="35" Canvas.Top="120">
  </Canvas>
  <Canvas Canvas.Top="10">
    <Rectangle
      x:Name="progressRectangle"
      Canvas.Left="20"
      Height="10" Width="0"
      Fill="Maroon" />
    <Rectangle
      Canvas.Top ="-1"
      Canvas.Left="19" Height="12"
      Width="202"
      StrokeThickness="1" Stroke="Black" />
    <TextBlock
      x:Name="progressText"
      Canvas.Top ="-4" Canvas.Left="230"
      Text="0%" FontSize="12" />
  </Canvas>
</Canvas>

 








Related examples in the same category

1.TextBlock
2.LinearGradientBrush
3.Ellipse
4.Polyline
5.RectangleGeometry
6.Ellipse.OpacityMask
7.Rectangle.RenderTransform