How to ensure correct positioning of TextBlock Text within a Rectangle?
It does not seem that the TextBlock in WPF/E (as opposed to WPF that have properties for Text alignment) have properties/methods for alignment of text. I have a rectangle (with a certain width and height) in which I want to position some text - using TextBlock - in the center; this has to be done programmatically on the server side when generating the XAML stream. Example,
<CanvasHeight="750"Width="750"xmlns="http://schemas.microsoft.com/client/2007"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"Background="transparent">
<RectangleHeight="100"Width="150"Canvas.Left="300"Canvas.Top="325"Stroke="Navy"StrokeThickness="1"Fill="Silver"/>
<TextBlockFontSize="16"FontFamily="Georgia"FontWeight="Bold"Canvas.Top="365"Canvas.Left="320">Topic</TextBlock>
</Canvas>
Any ideas of how to do this - any response will be highly appreciated, Thanks?
Kind Regards
Hans P. Dramstad

