简体   繁体   中英

create a Chat bubble in UWP using polygon

i am creating a chat application and would like to create the chat bubble in UWP using polygon and it look like this, 在此处输入图片说明

How can I make it behave like I want using polygon in XAML?

How can I make it behave like I want using polygon in XAML?

This chat bubble you showed above may not be created by Polygon , since the boundary is created by connecting a line from one point to the next, with the last point connected to the first point, but your shape contains arc.

You should be able to use Path which is a versatile Shape that you can use it to define an arbitrary geometry. More details please reference Draw shapes .

I created the above chat bubble by Path , and code as follows:

<Path
    Stroke="DarkGoldenRod"
    StrokeThickness="2"
    Data="M 50,50 A 20,20 90 0 1 60,40  L 230,40 A 20,20 90 0 1 240,50 V 100 L300,150 240,125 V180 A 20,20 90 0 1 230,190 H60 A 20,20 90 0 1 50,180 V50" />

You can update the path data as what you want. More details about the path data syntax please reference Move and draw commands syntax .

The result:

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM