WPF Grid Resize Unexpectedly - wpf

My project used Grid panel extensively for its auto-size feature. Here's how the MainWindow looks like. Now everything looks normal, but the moment i click the top edge of the window (resize) the Grid suddenly resize on its own, despite i haven't drag the cursor yet. This was how it looks like.
If i drag the window to full-maximize, then the Grid size return to what it was on application start (first image). Why it behaves this way?

Related

WPF control is on top of the window border, how do I stop that?

I have a WPF window and an Image in a grid in the window. I am animating the Image so it moves from out of view (beyond widow location) into the window.
The animation is nice and smooth and everything works but I notice the image is over top of the window border while it is moving. The image at the end of this question is what it looks like.
Why would the image be over top of the window border, and how do I get it to be "under" the border?
Thanks in advance!
Well after a lot of trial and error it seems the problem was the fact I was moving the image in a grid that had no defined width, so the width would expand over the border when moving the image thus extending the "client" area of the window and showing over the window area.
Once I defined a specific width of the grid, everything worked.

ExtJS Grid Panel Scrollbars

Having an issue with scrollbars appearing when the grid's contents are expanded beyond the view. I have a base window with a layout of vbox, aligned stretch with a grid panel with a layout of fit. The base window is contained within a view port region where it's also constrained. I'm using the rowexpander plugin that creates a nested grid, displaying related records.
Until the window is restored (defaults to maximized), the scrollbars don't show or update. This continues until the window is resized.
I've tried calling doLayout and doComponentLayout on the panel and it works but only 50% of the time. It's completely random and even more annoying.
I'm using version 4.07 of Ext and Chrome 17.0.963.56.

How to specify z-index for a panel

Hi I'm new to WPF and I want to place a Panel upon a StackPanel and show and hide it in my window without using Canvas and changing positions and size of other controls or the window.
Something like the fallowing image which the solution explorer is opened on another Panel, and as we see the user even can change the position of the Panel.
If you have a Grid as the Root Layout and a StackPanel on that, you can still use Canvas.
Canvas.SetZIndex(<YourPanelYouWantInFront>, <LargeValue (100)>);

Button change sized using Mouse

I would like to know if there is a way to resize a button Width using the mouse, like when you are in the design mode, I'd like to change the cursor to the resize cursor when the mouse pass over the edge of the button, and with a sutained click resize the button.
thanks !!
You should look into using Adorners for this. Here is an article on Code Project that describes how to "drag, resize and rotate elements on a Canvas", with and without Adorners: WPF Diagram Designer: Part 1

WinForm designer and right snapline for controls in container when resizing it

Using Visual Studio 2008 WinForm designer, I have a container (form, panel, groupbox, whatever) and some controls in it.
The container is set to not automatically resize or dock in any way. When placing a control in the container I can use the snaplines to help in positioning the control.
However, the snaplines does not appear when I resize the container to the edge of the contained controls...
Is there a simple way to have the designer show me the snaplines of the contained controls when resizing the container?
The designer will only show the snap lines when moving a child control within a container. You can demonstrate it by moving a GroupBox around a Form and see that it shows snap lines when the GroupBox gets close to the edge of the Form, but if you were to resize the Form you won't see the snap lines appear.
If you're just looking to get all of the controls to line up in a uniform fashion, I'd suggest switching to SnapToGrid mode and using the grid lines to align your controls. You can set the SnapToGrid mode by going to Tools->Options->Windows Forms Designer->LayoutMode. Open your designer and you should see the grid appear, after that you can line your controls up with the grid.
After setting the layout of the form, you can also set anchoring property to all child controls appropriately, to right and bottom (or top and left), depending on the resizing you are making. Anchor property will hold child controls to same distance from the edges of the container (parent control).
In the WinForms designer, there is no support for snaplines when resizing the container control. The best way to work around this issue is to first size the container to the size you would like to use and then add controls. Optionally, you can change the Margin property of the container so that when moving controls inside the container, they will snap to the margin of the container, keeping it uniform.
Try:
container.AutoSize = true
container.AutoSizeMode = GrowAndShrink
container.Padding.All = 5

Resources