I am using the Infragistics XamDialogWindow to approximate an MDI window in WPF.
Basically I have a user control that I assign to the content of the window and then add the XamDialogWindow as a child of a Grid.
I then have two buttons which display the windows as either "Tile" or "Cascade".
The cascade works really well but I am having problems with the Tile method.
I get the available width and height using the "ActualWidth" and "ActualHeight" properties of the container.
I then calculate the number of rows and columns needed.
Next I iterate through the columns and I calculate how many rows there are in a column, (this means that if there are an odd number of windows such as 5 I will have two rows in column 0 and 3 in column 1).
The width of each window is worked out as "AvailableWidth / numColumns"
The height of each window is worked out as "AvailableHeight / WindowsForThisColumn"
I then iterate through the rows and calculate the top left coordinate of the window we are positioning as follows:
left = columnIndex * width
top = rowIndex * height
The Left, Top, Width and Height properties of the window are then set.
PROBLEM
The Left, Top, Width and Height properties seem to be calculated correctly so for example
This should give a nice grid of 4 windows with no margins filling all available space, however this is not the result.
The windows seem to be offset when displayed (see image attached).
If I look at the Left, Top, Width and Height properties they all appear to be correct.
The weird thing is, if I click "Tile" a second time they will all appear correctly.
If I move a window after clicking tile the second time, they will appear correctly.
I have tried using a Canvas and setting the Canvas.Left and Top properties, A grid, stackpanel and wrappanel with the same results every time.
Hello Steven,
I've attached a sample here that reproduces the behavior. I wasn't able to reproduce the behavior with a Canvas and Rectangles therefore I have created case for you with ID CAS-183908-W5K5Z4. You could reach your case following the link bellow:
https://ko.infragistics.com/my-account/support-activity I will update you via the mentioned case, so if you have any further questions or comments please update your case.
Thank you, let me know if you need more information
Thank you for following up. Yes, freeform tile placement is considered to be a new product idea. You can add a vote to this here:
http://ideas.infragistics.com/forums/192363-wpf/suggestions/15676971-freeform-tile-placement-system-for-xamtilemanager
However I noticed you also posted this request on stackoverflow. I will use your code snippet to build a sample and replicate the behavior to investigate this further.
Let me know if you have any questions.
I have looked at those controls, but the thing is, I am so close to finishing my MDI app the way it is, you have a sample that shows the positioning of a XamDialogWindow using its Top and Left commands.
These are the commands I am trying to use and its is almost working, but they windows are offset slightly as seen in the picture.
If this is a known bug in WPF or an issue with the XamDialogWindow then I will have to consider using the XamDockManager but I am pretty sure it is a problem with the measuring of the parent grid prior to positioning.
The XamTileManager is almost what I want but you cant freely move the tile about, they are fixed in a position of one of the tiles, and this is unfortunately not what I want.
I would suggest using the XamTileManager or XamDockManager since WPF does not support the concept of MDI. Let me know if you have any questions regarding this matter.
In our online documentation for XamDockManager we have a specific article for creating a "Tabbed MDI Application".
Let me know if you have any questions regarding this matter.