How do I create a custom WPF control like a cartoon bubble with constant corners How do I create a custom WPF control like a cartoon bubble with constant corners wpf wpf

How do I create a custom WPF control like a cartoon bubble with constant corners


Use this XAML, You can create a PopUp or a ContentControl and can give this Grid as the control template on it to get a consistent look

<Grid x:Name="grid">    <Grid.RowDefinitions>        <RowDefinition Height="*"/>        <RowDefinition Height="40"/>    </Grid.RowDefinitions>    <Rectangle Fill="#FF686868" Stroke="#FF000000" RadiusX="10" RadiusY="10"/>    <Path Fill="#FF686868" Stretch="Fill" Stroke="#FF000000" HorizontalAlignment="Left" Margin="30,-1.6,0,0" Width="25" Grid.Row="1"         Data="M22.166642,154.45381 L29.999666,187.66699 40.791059,154.54395"/>              <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="25" Text="Hello World" TextWrapping="Wrap"/>           </Grid>

removed dead ImageShack link

I have made a blog post on this


The rounded corners can just be a Border with Corner Aliasing set.

The constant / speech arrow can be a path that is positioned in a grid along with the border.

Take a look at the control template for the GroupBox and see how the "Header" content is positioned to float over the Border of the group box.

You would do the same thing except you would position a Path at the bottom instead of the top.