Home > other >  Ask how WPF center?
Ask how WPF center?

Time:02-21

What I want is centered, not to control set width centered, again, and found that such a simple function don't have a way to solve, I search for a night,, oh my god,,,

CodePudding user response:

Settled, and every time is what you get is not, and then a Posting on BBS, and others also didn't answer myself out again,, dizzy



Just know originally the grid will not fill the entire window, you have to set the width,,, oh my god,, dizzy

CodePudding user response:

You said what
The grid default is fill you the width of the fixedpage

CodePudding user response:

 





CodePudding user response:

HorizontalAlignment="Center"

This property is set within the parent controls horizontal center


VerticalAlignment="Center"

Corresponding, this is the vertical center

CodePudding user response:

refer to the second floor qq14923349 response:
you said what
The grid of the width of the default is to fill the fixedpage you ah

Is not the default,,, I am not set the width of the grid is not centered, set up center immediately,,

CodePudding user response:

Actually very simple everyone from this stage
Face the problem when the first is anxious various methods to try all kinds of baidu more cannot solve the bad mentality is

Why after Posting can solve because you need to think about how this problem in Posting this process in understanding the problem finally find the key! Find the problem is solved half

I believe that you are a good programmer

CodePudding user response:

Grid is not set when the width should be auto automatically, so there is no Fill is how long the actual how many, unless some layout elements in the grid with the upper like Viewbox, set up Stretch="Fill", should be automatically populated, and feel a little bit with the HorizontalAlignment="Center" will be better,
  • Related