I have a GridView with grouped data.
All is like in Grouped Items Page template in VS2012 except I set more data then they do there (around 15 groups, around 200 items total).
All is fine except strange overlapping effect in the middle of page. It's not always on same place. When scrolling this overlapping area can move to other groups.
Any idea why this happens?
I bet this is because you nest ScrollViewers - perhaps put multiple GridViews in a ScrollViewer or a "master GridView".
I tried to reproduce same problem in the project I just created using Grid App project template in VS2012.
I copied my DataSource object there and all worked fine until I did one small thing - set HidesIfEmpty="True" for GroupStyle of the GridView.
Incredible but this small option which should help us hiding empty groups makes this strange overlapping effect.
Related
I'm new to Xamarin Forms, and am trying to create a page that has 4 sections of read-only data, one of which is a list of clickable items. In addition, the top section needs to be stationary (always on top).
My initial attempt was to use various StackLayouts, with a ScrollView to control this. There was much advice against putting a ListView in a ScrollView. After some struggles I got it to work, but then ran into an odd app crash on the ListView binding the second time a page is loaded (simple labels with the same binding are fine).
So my question is, should a ListView be used when many other elements are also on the page? If so, should the header and footer of the ListView contain the other controls, effectively making the ListView the root control? Is there an alternative suggestion to get a bound, clickable list on a page with other controls? Or maybe I'm running into difficulty simply due to the ListView needing to be in a ScrollView?
I'm trying to achieve a view similar to this ((Sub)(Sub)Item names not being part of the view - they show how the source data is structured):
EDIT:
As per comment, I'm adding an example of how I want to render the data (2 items):
That is, I have bunch of Items which I want to render in customized way. Those have SubItems that start being part of the grid (possibly spanning multiple cells). And those have SubSubItems with more data to put inside the grid (each on one row).
I want the data that belongs to a grid, to be aligned according to my Column headers.
I manged to make this work using a ListBox with ItemTemplate set to DataTemplate defined in resources. Going down 3 levels of hierarchy, using Grids to layout the content. There were 2 issues with this:
Aligning the data in grid with column headers. I managed to solve this using top level grid as column headers and IsSharedSizeScope/SharedSizeGroup. But it wasn't very nice solution and the alignment proved difficult to achieve.
Drawing borders around cells - since it wasn't just one Grid, but multiple within each other, borders would not connect nicely or have different thickness. I didn't manage to solve this so far.
I tried using ListView instead of ListBox, with GridViewColumn, but that disabled the ItemTemplate rendering.
Is there a way to use both? Or some other way to add the Columns with their default nice style and on-the-fly re-sizing capabilities? What about the cell borders?
Or am I looking at it entirely wrong and I should use different approach altogether?
I did try using DataGrid but that seemed even worse approach.
Note: I need virtualization - working with lots of items.
My app shows newsfeed from social network. Every feed has different attachments - images, video, audio, etc, - so every feed has different height. Newsfeed shows in listbox using template selector. I read MSDN and as i can see - i broked almost all rules how to use listbox (non fixed sized items, nested listboxes, and so on). As result - i have laggin listbox, which jumping from item to item when it wants. So, if MS couldn't make a listbox, which can normaly works with dynamic items, what sould i use to get smooth scrolling by items?
UPD: Why minuses? Can you explain? Its a bad question? I think not only for me its important.
You can try the ItemPresenter control with a ItemTemplate.
You could try stackpanel inside a scrollviewer.
Also you could make images and text load only when scrollviewer gets close to displaying that item, not load everything all the way at the start.
This reduces internet traffic, loading time and the lag while scrolling. Ofcourse it will take some of your coding time, but believe me - it will be well worth it! Most services use this thus cutting server load and traffic.
Check if that helps!
In my WPF application, I've got a screen with a tab control. Five of these tabs contain datagrids which need to display a large number of rows (at least 5000). The tables are bound to ObservableCollections of Part objects. Each row displays around 20 points of part data. My problem is that, after the user enters the information they require and generate the data, clicking on a tab causes the application to hang for 30-60 seconds. After this the datagrid finally loads, and with the right virtualization settings, they perform at an acceptable rate (not exactly fast, but not too slow). If I disable virtualization, the program uses up way too much memory, and the loading time isn't really affected.
The most offensive tables consist of about half a dozen template columns. Each template contains controls inside a stackpanel or a grid; basically each row is split into two, like a double-row. This layout is a requirement, and paging is probably not something that the customer is willing to accept.
This is the most important screen in my application and I'm pretty much at a loss about making this work. Is there anything I can do to speed up this process? Perhaps ObservableCollection is the wrong choice?
Can you please provide more insights...
Can you check how much time is spent in "generating" the 5 collections of 5000 rows each? (this is what I assume you are saying)
With virtulaization "on" what is the UI loading time "after" we assign the collection to the items source?
What happen if you bind "ItemsSource" to the respective datagrid only when the tabItem is actually Visible \ Selected?
Do you datagrids have default sort member path? Grouping? Filter Paths?
These are a few things I would target to start on the issue.
Well it's not playing actually.
I have a database with about 200 list of items in it. I've used DataTable to fetch all the data in single connection.
Then created a windows button that creates new button for all the items.
It is OK and I was able to do it easily.
But I stuck over two things..
First is, I have limited space in my windows form, that's why I want to load only 30 buttons at first and then upon second click event, I want to load buttons for remaining 30 items and so on..
Second problem is, even if i managed to solve the first problem? How to arrange them in proper row/column?
Please help.
Grab an ordered list of records, split it to a list of "pages" (which is also a list of records) and use navigation buttons to change the context of current page.
Why don't you take a DataGridView with a BindingSource and a DataGridViewButtonColumn? With this as a starting point you can simply glue them together by calling:
myDataGridView.DataSource = myBindingSource;
myBindingSource.DataSource = myDataTable;
Update
Surely you can try to do the whole visualization on yourself by using a TableLayoutControl. But the DataGridView is a control that is specialized to visualize data in a data grid (hence the name of it).
The grid view is a very complex control, but it has a lot of nice features which make your results looking more professional by simply configuring some properties of it. For example simply set the property AutoSizeColumnsMode to Fill to simply avoid horizontal scroll bars and set the Column.AutoSizeMode of some columns to e.g. DisplayedCells to enforce which columns should be wrapped, etc.
Also there are a lot of features regarding to data validation, formatting, etc. So i think even if the step-in hurdle is a little higher you got a much better visualization then trying to do all this stuff manually by taking a TableLayoutPanel. Last but not least there are lots of examples about how to use the specific properties within the MSDN and if you get really stuck just search for the problem here on SO or on the web and if you don't find a proper solution just ask a question here on SO.