Hi all.
I’ve got a weird behaviour (on version 4.2) using “TextAlignment” on a Text component.
The following code…
Text message = new Text(MyFont, "My text");
message.SetMargin(20);
message.TextAlignment = TextAlignment.Center;
message.Visibility = Visibility.Hidden;
StackPanel sp = new StackPanel();
sp.Children.Add(message);
display.WPFWindow.Child = sp;
will raise a NullReferenceException at runtime
Using mainboard GHI Electronics FEZSpider version 1.0
Program Started
#### Exception System.NullReferenceException - CLR_E_NULL_REFERENCE (1) ####
#### Message:
#### Microsoft.SPOT.Presentation.Media.MediaContext::RenderMessageHandler [IP: 00e0] ####
#### Microsoft.SPOT.Dispatcher::PushFrameImpl [IP: 0054] ####
#### Microsoft.SPOT.Dispatcher::PushFrame [IP: 001a] ####
#### Microsoft.SPOT.Dispatcher::Run [IP: 0006] ####
#### Gadgeteer.Program::Run [IP: 0020] ####
A first chance exception of type 'System.NullReferenceException' occurred in Microsoft.SPOT.TinyCore.dll
… but if I comment the line…
message.TextAlignment = TextAlignment.Center;
…it perfectly works !
The same error is encountered for every value of the enumeration (Left, Right, Center)
What’s the problem with TextAlignment?