show-notice
hide-notice

Tuesday, 16 July 2013

Line, Rectangle, and Ellipse Geometries in Silverlight


Introduction

I will explain Line, Rectangle, and Ellipse Geometries in Silverlight 
Description

The LineGeometry, RectangleGeometry, and EllipseGeometry classes map directly to the Line, Rectangle, and Ellipse shapes that you learned about in the first half of this chapter. For example, you can convert this markup that uses the Rectangle element:

Example

<UserControl x:Class="VC34.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">

      <Grid x:Name="LayoutRoot" Background="White">
            <Rectangle Fill="Yellow" Stroke="Blue" Width="100" Height="50" ></Rectangle>

            <Path Fill="Yellow" Stroke="Blue">
                  <Path.Data>
                        <RectangleGeometry Rect="0,0 100,50"></RectangleGeometry>
                  </Path.Data>
            </Path>
      </Grid>
</UserControl>


CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VC34
{
    public partial class Page : UserControl
    {
        public Page()
        {
            InitializeComponent();
        }
    }
}
 

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com