I have managed to easily reproduce the behavior with the same setup. Investigating the UWP layout at runtime, I have noticed that indeed the HorizontalContentAlignment
is reset to "Center"(which is its default value) for some reason. I have logged the behavior as a bug at our end so we can review it in more details. You can track its progress on the following link from our Ideas & Feedback
portal - Button: [UWP]HorizontalContentAlignment is reset to its default value in Release mode
. I have added some points to your account for reporting the undesired behavior. Please subscribe to the public item in order to receive automatic notifications once there is any progress on the matter.
In the meantime, as a workaround, I have managed to avoid the behavior by subscribing to the Loaded event of the native element in UWP and setting the HorizontalContentAlignment
of the Button there:
CustomButtonRenderer : Telerik.XamarinForms.InputRenderer.UWP.ButtonRenderer
.Control.Loaded += Control_Loaded;
sender, Windows.UI.Xaml.RoutedEventArgs e)
RadButton).HorizontalContentAlignment = TextAlignment.Start;
Note that, in order to use a custom renderer for the RadButton, you need to create a custom class that inherits the RadButton one and eventually target this class in the custom renderer. This is a small limitation of the control as it inherits from the default Button class. Please have a look at the attached sample for more reference.
Would such approach work for you?
Have a great week.
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Telerik Feedback Portal
and vote to affect the priority of the items