WWW
WWW

Reputation: 9

Cannot convert "TextAlignment.Center" into Xamarin.Forms.TextAlignment

When I did following code: TextAlignmentConverter textAlignmentConverter = new TextAlignmentConverter(); var abc = (TextAlignment)(textAlignmentConverter.ConvertFromInvariantString("TextAlignment.Center"));

I got error message: System.InvalidOperationException Message=Cannot convert "TextAlignment.Center" into Xamarin.Forms.TextAlignment

Any ideas? TIA.

Upvotes: 0

Views: 50

Answers (1)

Jason
Jason

Reputation: 89102

from the docs

This converter recognizes and converts string representations of the FlowDirection enumeration, as well as the following strings, regardless of case: "left", "right", and "center".

use "Center", not "TextAlignment.Center"

Upvotes: 1

Related Questions