I am working on a Metro App using C++ and XAML. I want to create a polygon shape and add text inside it.
At first I thought of defining my own Controltemplate and apply it to Textblock but unfortunately it does not understand TargetType = "TextBlock".
Secondly, I thought of inheriting the Polygon class and see if I can do anything there but that class is sealed.
Any ideas on how to achieve this?
Here's how to create a TextBox in XAML and in code. TextBox textBox = new TextBox(); textBox. Width = 500; textBox.
Creating a TextBox The Name attribute represents the name of the control, which is a unique identifier of a control. The code snippet in Listing 1 creates a TextBox control and sets the name, height, width, and content of a TextBox control. Text="Hello! I am a TextBox.">
In WPF XAML you could do something simple like this:
<Grid Width="60" Height="100">
<Ellipse Fill="Yellow"/>
<TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Text="Hello"/>
</Grid>
To get text in the centre of a yellow ellipse.
I'm guessing something that simple will work on WinRT.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With