This seems close to some other questions I've seen out here, but not close enough...
I have a grid with three rows. The first row holds a custom grid that I want to have as much space as possible. I set its Height to "*". The second row is a row of buttons; it is "Auto". The third row is a user control that contains another custom grid that has an unpredictable number of rows (none at design-time, filled in at run-time).
If I set the third row to "Auto", it doesn't get any space at all. I need to understand what I have to do after I load the third-row's grid to make it then figure out what "Auto" should be. Or, if "Auto" doesn't apply, how else do I get the third row to take up Just Enough space?
Does my custom grid have to fire something like a resized event after it is loaded?
You shouldn't have to do anything
If the 3rd row's Height is Auto, it will resize according to the size of it's contents. If the size of the contents change at runtime, so will the size of the Row.
You can also set limitations on the Row's Height by setting MinHeight and MaxHeight on the 3rd Row so it doesn't get smaller or larger than a specified height.
Cells will collapse to fit their contents. If the contents don't have any specified size then the cell will collapse to nothing. I'm guessing for your middle row the buttons have fixed sizes, so the row collapses to the size of the buttons, but your third row has nothing with a fixed size so it collapses to nothing. Try giving your third row a fixed size either for the whole row or for each row in the contained grid.
Related
I want to autosize the grid columns to max size of the content. How do i do this. i see only autoSize function on grid column, not sure how to use it.Say column header width is more then the column data width, that should be used.
I have used autosize function, It works, but i have few issues, I have to define the align property i.e text fields will be left and number fields will be on right, then heading text gets cut. I have locked columns in all reports, locked section gives some empty spaces.
https://fiddle.sencha.com/#fiddle/1cr6
See column selling code. Its not showing full because of align: Right property. If you remove it will work.
2.After DOW column empty space is coming.
Without minWidth Property columns wont scale properly.
Take a look at this piece of documentation: Ext.grid.column.Column - Setting sizes. I don't think you can make columns scale to content. You can, however, set fixed sizes or make them flex.
I hope this helps.
I have a DataGrid with a custom theme. Right now, if I resize a column and make it wider, it tries to squeeze other columns to make space for this column.
Instead, is it possible to increase the width of the entire DataGrid with the increase in width of a column. It's OK if it shows a horizontal scrollbar at the bottom.
EDIT: Just to clarify, each column has a MinWidth set to it. So if the overall width > window width, I see a scrollbar. But in cases where I have a datagrid <= window width, and I expand one of its column, the width of the datagrid should theoritically increase at the point when the other columns have shrunk to their MinWidths. At that point, instead of letting the DataGrid grow in width, it doesn't let me expand the column any further. Instead, I want the DataGrid to expand and accommodate the increased space.
It sounds like one of your columns has a Width="*", which means that column is assigned to all remaining space and grows/shrinks as needed instead of letting the DataGrid grow/shrink as requested and showing it's HorizontalScrollBar.
The datagrid's default behaviour is the one you need! If your Datagrid is not showing a horizontal scrollbar maybe because it's contained in a control that's constraining its width. Try to put it inside a Grid, and be sure that you haven't set the 'Width' property of any control (including the Window) that is containing it.
that's what column's MinWidth is designed for. Just set it for the columns, which you don't want to shrink. to limit the max width of the grid use the ScrollViewer:)
I have a dialog with column down the right side filled with buttons. The dialog is built with Windows Forms. I have a mockup at the following link:original dialog
(I would have included it but apparently i'm not allowed to use image tags)
I would like for the buttons in the right column to resize themselves to fill the remaining vertical space when the dialog resizes. It doesn't particularly matter to me whether or not buttons simply increase in size or whether the buttons remain the same size while the gaps between them increase. I'm simply want the buttons to go from the top to the bottom. (I have a mockup for this as well but apparenlty i can only include one link)
I've tried hosting the buttons in a FlowLayoutPanel but they do not increase as the dialog stretches, I only get whitespace at the bottom after I run out of buttons. I also tried a TableLayoutPanel and had the same result but I may have misused it. Does anyone have any ideas how I could accomplish this?
Thanks in advance,
Jeremy
To get you started. Use the TableLayoutPanel, set its Anchor property to top, bottom, left, and right. Set the rows and columns to percentages as needed. I suggest each control have it own cell. Note that each control in a "cell" can have its Dock and Anchor property set as needed.
You can do this with a TableLayoutPanel. Create a column for the buttons, with each button having it's own row / cell in the column. Set each row to be an even percentage for height (if there are 10 buttons, each row would be 10%), and dock the TableLayoutPanel to the right side of the screen. Then, put the buttons into their rows and set them to full docking. Then, when the dialog expands, the TableLayoutPanel will expand to fill the entire right side of the screen, each row will adjust proportionally, and each button would expand to fit the new row size.
You may have to adjust this a bit to fit your needs, especially in how it relates to the other content in the window.
I have a Silverlight DataGrid and want to show the RowDetails of selected rows (RowDetailsVisibilityMode="VisibleWhenSelected").
That is no problem. But at the same time I would like to hide the selected row itself. Kind of swapping a row with its details.
Setting the row Visibility to Collapsed or the Height to 0 does not work for me because then the details will also be hidden. Is there a way to handle this situation?
I found a solution:
The height of the row is the height of the row itself plus the height if its details. Although you cannot retrieve this height at run time (it is 'NaN'), its possible to set it. As I pointed out in my question, I tried to set it 0, which makes it disappear completely, including the details. But if I just set the height of the row to the height that the details will have according to my style, the display of row with details will be cropped on top and make the row slide 'behind' the row or header above. And that's exactly what I wanted.
Is there a good way to limit the Auto Width of an element or Grid Column?
I want to limit the Auto Width only, but allow any user changes.
For example, I want to allow GridSplitter to arbitrarily resize the column, but the initial (Auto) Width should not exceed a specific value. Same for the elements -- I want to allow resizing, but limit the Width they have if never resized.
MaxWidth works exactly as opposite -- it does not affect Auto Width of Grid Columns (it might be a bug), but limits the resized width.
Is there any good solution that works for (almost) any element or Grid part?
Try binding the MaxWidth to the Width and use a IValueConverter to react to changes from Auto to specific values.
In the grid column set the width you want the column to start at. Any changes to the column width made by the user using the grid splitter will overwrite the width you start with.