Reputation: 28586
I have a WPF UserControl. I have inside a Label (autosized).
How I do for center the label in the middle of the UserControl?
Upvotes: 1
Views: 858
Reputation: 525
You can use attributes: VerticalAlignment and HorizontalAlignement with the "Center" value.
Or you can have something like that:
Label.Margin = String.Format("{0},0,0,0",UserControl.actualWidth/2);
Upvotes: 4