Page view counter
RC0 - TextAlignment in Style Setter for Button causes System.Windows.Markup.XamlParseException: Subscribe to this thread
Last post 09-26-2008 4:22 PM by coughlinj. 1 replies.
Sort Posts:
09-26-2008 3:54 PM
RC0 - TextAlignment in Style Setter for Button causes System.Windows.Markup.XamlParseException:
I have a recent MSDN magazine sample code for Silverlight 2.0 and I am trying to run it with Silverlight RC0. When I run the code it gets a System.Windows.Markup.XamlParseException on the LoadComponent(App.xaml) on the following line in a Style Setter for TargetType="Button" :

vsm:Setter Property="TextAlignment" Value="Center"

This is apparently another recent breaking change. How do I set the TextAlignment in a Button Style in SL RC0?

The same seems to be true for TextWrapping in Style for Button. How do I set the TextWrapping property?
dbaechtel

Loading...
Joined on 09-02-2007
Posts 204
09-26-2008 4:22 PM
Marked as Answer
Re: RC0 - TextAlignment in Style Setter for Button causes System.Windows.Markup.XamlParseException:

Yes TextAlignment and TextWrapping have been removed as per the breaking change doc.

One way of getting around the alignment is just to use HorizontalContentAlignment.  It of course will affect all content of the button.

 

The text wrapping (and for that matter the TextAlignment) can be specified on a TextBlock that is used as the content of the button.  For example...

        <Button VerticalContentAlignment="Bottom" HorizontalContentAlignment="Left">
            <TextBlock Text="Hello world" TextWrapping="Wrap" />
        </Button>

 

This would be the equivalent of Beta 2's

<Button Content="Hello world" TextAlignment="Left" TextWrapping="Wrap" />

 

Hope that helps I realize your situation maybe more complicated.

coughlinj

Loading...
Joined on 03-07-2008
Vancouver
Posts 114
Microsoft Communities