show-notice
hide-notice

Wednesday, 17 July 2013

how to create ellipse in silverlight


Introduction

I will explain how to create ellipse in silverlight.

Example

<UserControl
      x:Class="SilverlightApps.MainPage"
      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="600"
      d:DesignWidth="800"
      xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
        >
      <Grid
x:Name
="LayoutRoot" Background="White">
          
<
TextBlock
                
Height="82"
                
HorizontalAlignment="Left"
                
Margin="20,12,0,0"
                
Name="textBlock1"
                
Text="Silverlight - how to create ellipse"
                
VerticalAlignment="Top"
                
TextWrapping="Wrap"
                
FontSize="20"
                
FontStyle="Italic"
                
Foreground="MidnightBlue"
                
Width="625"
              
/>
          
<
Ellipse
                
Name="ellipse1"
                
Fill="#FFF4F4F5"
                
HorizontalAlignment="Left"
                
Height="131"
                
Margin="53,94,0,0"
                
Stroke="Black"
                
VerticalAlignment="Top"
                
Width="201"
              
/>
          
<
Ellipse
                
Name="ellipse2"
                
Fill="DarkSeaGreen"
                
HorizontalAlignment="Left"
                
Height="131"
                
Margin="283,94,0,0"
                
Stroke="Black"
                
VerticalAlignment="Top"
                
Width="201"
              
/>
          
<
Ellipse
                
Name="ellipse3"
                
HorizontalAlignment="Left"
                
Height="192"
                
Margin="53,243,0,0"
                
Stroke="Red"
                
StrokeThickness="3"
                
VerticalAlignment="Top"
                
Width="431"
              
>
                
<
Ellipse.Fill>
                      
<
LinearGradientBrush
StartPoint="0,0"
EndPoint
="1,1">
                            
<
GradientStop
Color="Red"
Offset
="0.1" />
                            
<
GradientStop
Color="Green"
Offset
="0.5"/>
                            
<
GradientStop
Color="Orange"
Offset
="0.75"/>
                      
</
LinearGradientBrush>
                
</
Ellipse.Fill>
          
</
Ellipse>
      </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 SilverlightApps
{
    public partial class MainPage : UserControl
    {
       
public
MainPage()
        {
           
InitializeComponent();
        }
    }
}
 

SHARE THIS POST   

0 comments :

Post a Comment

Design by Gohilinfotech | www.gohilinfotech.blogspot.com