ContentDialog Dialog = new ContentDialog();
private async void DisplaySessionDialog()
{
var bStyle = new Style(typeof(Button));
bStyle.Setters.Add(new Setter(Button.ForegroundProperty, new SolidColorBrush(Colors.White)));
bStyle.Setters.Add(new Setter(Button.BackgroundProperty, new SolidColorBrush(Colors.Maroon)));
bStyle.Setters.Add(new Setter(Button.HorizontalContentAlignmentProperty, HorizontalAlignment.Center));
bStyle.Setters.Add(new Setter(Button.VerticalContentAlignmentProperty, VerticalAlignment.Center));
bStyle.Setters.Add(new Setter(Button.CornerRadiusProperty, new CornerRadius(15)));
bStyle.Setters.Add(new Setter(Button.PaddingProperty, new Thickness(5)));
bStyle.Setters.Add(new Setter(Button.MarginProperty, HorizontalAlignment.Center));
bStyle.Setters.Add(new Setter(Button.FontSizeProperty, 18));
Dialog.Title = val.SessionExpireTitle;
Dialog.Content = val.SessionExpireContent;
Dialog.PrimaryButtonText = val.SessionExpireButtonLabel;
Dialog.PrimaryButtonStyle = bStyle;
Dialog.FontSize = 18;
await Dialog.ShowAsync();
}
The above code is working fine. However, I want to alignment button as a centre and title alignment centre, content also from left. I tried more ways and search a lot of things I did not find any solutions . Please help me, is there any way to align title in c# for UWP app