public static ContentAlignment GetStyleContentAlignment(Style style, StyleInstance styleInstance) { TextAlignments styleTextAlign = MappingHelper.GetStyleTextAlign(style, styleInstance); VerticalAlignments styleVerticalAlignment = MappingHelper.GetStyleVerticalAlignment(style, styleInstance); ContentAlignment result = ContentAlignment.TopLeft; switch (styleTextAlign) { case TextAlignments.Center: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomCenter; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleCenter; break; default: result = ContentAlignment.TopCenter; break; } break; case TextAlignments.Right: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomRight; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleRight; break; default: result = ContentAlignment.TopRight; break; } break; default: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomLeft; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleLeft; break; } break; } return(result); }