Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Question] Create Shape with C# #11529

Discussion options

You must be logged in to vote

@ronymesquita Yes, everything available in the Shapes API can be used both from XAML and from C# code. Example:

<Ellipse
    Fill="Yellow"
    HeightRequest="100"
    WidthRequest="200"
    StrokeThickness="2"
    Stroke="Black"/>
Ellipse myEllipse = new Ellipse();

SolidColorBrush mySolidColorBrush = new SolidColorBrush();

mySolidColorBrush.Color = Color.FromArgb(255, 255, 255, 0);
myEllipse.Fill = mySolidColorBrush;
myEllipse.StrokeThickness = 2;
myEllipse.Stroke = Brushes.Black;

myEllipse.WidthRequest = 200;
myEllipse.HeightRequest = 100;

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ronymesquita
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants