Ellipse in WPF:
<Ellipse
Width="190"
Height="90">
<Ellipse.Fill>
<LinearGradientBrush>
<GradientStop
Offset="0"
Color="Wheat"/>
<GradientStop
Offset="1"
Color="White"
/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
How to use Ellipse on button's
background?
<Button
Height="100"
Grid.Row="1"
Grid.Column="1"
Width="200">
<Ellipse
Width="190"
Height="90">
<Ellipse.Fill>
<LinearGradientBrush>
<GradientStop
Offset="0"
Color="Wheat"/>
<GradientStop
Offset="1"
Color="White"
/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Button>
Now I am taking a simple example to
show how to create Ellipse on button's background and also how to show the
message on messagebox using WPF.
Example:
MainWindow.xaml:
<Window
x:Class="test_WPF.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow"
Height="350"
Width="525">
<Grid>
<Grid.RowDefinitions>
<RowDefinition
Height="58"
/>
<RowDefinition
Height="122"
/>
<RowDefinition
Height="131*"
/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition
MinWidth="50"
/>
<ColumnDefinition
Width="Auto"
/>
<ColumnDefinition
Width="*"
/>
</Grid.ColumnDefinitions>
<TextBlock
Text="Enter
Name:"
Grid.Row="0"
Grid.Column="0"
/>
<TextBox
x:Name="txtName"
Grid.Row="0"
Grid.Column="1"
MinWidth="50"/>
<Button
Height="100"
Grid.Row="1"
Grid.Column="1"
Width="200"
Click="Button_Click">
<Ellipse
Width="190"
Height="90">
<Ellipse.Fill>
<LinearGradientBrush>
<GradientStop
Offset="0"
Color="Wheat"/>
<GradientStop
Offset="1"
Color="White"
/>
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Button>
</Grid>
</Window>
Design view:

MainWindow.xaml.cs:
Imports
System.Collections.Generic
Imports
System.Linq
Imports
System.Text
Imports
System.Windows
Imports
System.Windows.Controls
Imports
System.Windows.Data
Imports
System.Windows.Documents
Imports
System.Windows.Input
Imports
System.Windows.Media
Imports
System.Windows.Media.Imaging
Imports
System.Windows.Navigation
Imports
System.Windows.Shapes
Namespace
test_WPF
''' <summary>
''' Interaction logic for MainWindow.xaml
'''
</summary>
Partial
Public Class MainWindow
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private
Sub Button_Click(ByVal sender
As Object,
ByVal e As
RoutedEventArgs)
MessageBox.Show(String.Format("Hello
{0}", Me.txtName.Text))
End Sub
End Class
End Namespace
Output:
Now debug this application and enter your name then the message box shows as
follows:
