I am laying out views using GridLayoutManager which works fine. However I each item in the grid fills the whole width of the column which makes the view having lots of empty spaces hence I want to use wrap_content for the root view of items but its not working. There's still spaces left from the right side of the grid.
Since no one has been able to answer this, I will just outline what I did to sort it. I use ItemDecorator to fill the space between the columns
Related
I'm struggling to figure out how do I make a flow layout panel that has strictly just one column and upon scrolling it adds the controls at the bottom of that column and not make a new column and so on while having it wrap the controls. I can get that If wrapcontents = false. For some reason in my case the scroll bar appears horizontally at the bottom and not vertically at the right side.
How do you make it as explained?
I am trying to create the following layout with a NSTableView:
A big banner per section on the side and regular text content rows on the right side.
The Image on the left side is the problem. It should behave like a floating section when scrolling (stay below the section header). It seems impossible to have the view part of the NSTableView as each column of a row needs to have the same height.
I already tried a lot of things, but I need some input which is the right direction.
What I tried:
Add the image view as a floating view into the NSScrollView? That seems like a good approach, but it doesn't stick on top while scrolling and the (re)positioning within the table is... tricky. Any hints here?
Add the view into the section header and disable clipping somehow (to make them larger than the section)? Couldn't make that work.
Having a table with NSStackViews per row that host itself tables - that did work, but: Independent selections per table is not what I want.
Ok, I finally found a solution.
The view is added to the floating view container of the NSScrollView that holds the NSTableView. I use the bounds of the row views and translate that to coordinates of the floating view container.
I also modified the selection drawing to make it look good and recalculate the coordinates on animations.
Initially I was under the impression that it uses the table row slideup/down animations while inserting/deleting new rows but I doubt if it's doing that as it does it so fluidly even with thousands of items in the list (otherwise it would take a lot of time for the deletions/insertions to work).
Am I right in my assumption that it's simply attaching a new instance of the News list at the bottom of the screen, shrinking the above one while the one at the bottom expands to fill up space?
UPDATE:
Please see this video of what I mean: http://dl.dropbox.com/u/4960327/ReederAnim.mov
I can not tell you exactly how Silvio Rizzi made this, but as you see in the playback, a list view is added behind the shown list view, and the front list view fades out (.alpha = 0.0;) while the list view behind it expands its height per row.
When you desicate it frame by frame it becomes quite clear what he does, and it is really not that advanced. But I have to admit, with the white "milky" polished interface, it looks quite neat.
In addition, you can see that while animating, the background list view only renders the top 7 entries (hopefully calculated by dividing the view height with the average height of the cells shown) making the list view quick to load. Then afterwards, he can load an extended array of cells once you start scrolling, or in a background thread starting once the animation is complete.
EDITED:
I think we can just draw an image that resemble the grid using this article : drawing in a datagridview Currently creating a way to make the image drawn in tile mode. :)
Each time I develop a datacentric application using VB.NET regardless of how much the data displayed in the datagrid, I always want the grid to display full row of empty data, not just blank panel.
Can we achieve this using VB.NET design time property?
And also, we must not trigger the display of vertical scrollbar this way.. :)
Thanks
You might try doing a screen capture of the dgv when it is full of blank lines and use that as your background. However, you'll have a problem with the vertical lines if they resize the columns. In your picture you don't have any vertical lines so if you don't need them then just erase them and your problem is solved.
There's also the option of using the Virtual Mode. When you set that property to true then you can set the number of visible rows, but you are responsible for telling the dgv what each individual cell is supposed to contain: http://msdn.microsoft.com/en-us/library/2b177d6d.aspx
Or you can just add extra blank rows to whatever datasource you are setting your DGV to.
Use the ScrollBars property to turn the vertical scroll bar off.
When I place a ListBox inside a ScrollViewer, if I do not define a Height attribute for the ListBox, it doesn't scroll (aside from bouncing up and down a bit), so elements off the screen are inaccessible. If I set the Height attribute on the ListBox to the actual height it takes up on the screen, it scrolls perfectly. If I don't get the Height exactly right, it doesn't scroll properly, e.g. I might not be able to reach the bottom elements in the list.
When placing other elements in the single column LayoutRoot Grid above and below the ScrollViewer/ListBox, I set the RowDefinition.Height="Auto" on all rows except the ScrollViewer's, which gets "*". The Grid appears to properly allocate space accordingly. Except now I don't know a priori how much space the ScrollViewer/ListBox takes up.
Part A: Why should I have to set the Height on the ListBox, doesn't its (virtual) height vary with the number of elements?
Part B: It appears I have to manually lay out the Grid row heights, then manually re-do them if a fontsize or other style change is called for. Is that the case? That approach seems bogus.
Your problems are caused because you've got a ListBox inside a ScrollViewer. Don't do this.
The Listbox contains an internal ScrollViewer and will (normally) grow to the available space.
By essentially having a ScrollViewer inside a ScrollViewer it doesn't know which one should grow to fit available space and how they should scroll relative to one another.
Let us know what you're trying to do. There is a better way to do it.