Search code examples
wpfpowershellcodeplex

Lock a Grid in Show UI


Can Any one help me on how to lock the grid in showui module in powershell??

Im creating a application which uses a grid

Grid -ControlName 'Show-Demo' -Columns Auto,* -Rows 9 -MinHeight 500 -MaxHeight 500 -MinWidth 500 -MaxWidth 500 {

} -Show

When i run this i'am able to get a grid view but the size is not locked, im still able to resize the grid with my mouse, i wanted to avoid that and permanently lock it to MAX and MIN height and width of 500


Solution

  • The grid is fixed size already. Try setting -Background Blue on the grid and then resize, you'll see what I mean.

    What you want is to make the Window not resizable. For that, you'll have to actually specify the Window, instead of just using -Show on the grid:

    Window { 
        Grid -ControlName 'Show-Demo' -Columns Auto,* -Rows 9 {
           ...
        }
    }  -MinHeight 500 -MaxHeight 500 -MinWidth 500 -MaxWidth 500 -Show