Can the WPF ListView/GridView display multiline items? - wpf

My application uses a ListView/GridView control to display data records that the user can select and edit. This is based on http://www.switchonthecode.com/tutorials/wpf-tutorial-using-the-listview-part-3-in-place-edit. Now I have a case where the number of columns is larger and there's a text description on every line that indicates what object the user is editing in the line.
To save horizontal space, can that text description for each item be displayed above the other columns, in a separate row, spannng multiple columns, but still be included in the item selection when an item is selected? While all other columns are editable when selected, that info text is only static and cannot be edited by the user.
Here is a screen mockup as I felt it is necessary to understand what I mean. The red rectangles are only for highlighting the area of interest, they are not displayed in the application. This is based on the screenshot of the above mentioned link and the application behaviour is otherwise exactly the same. I just want that additional row to be displayed in each item.
Edit 2: Now as I think about what I've painted, it looks like the grouping from ListViews in Explorer. Those group headers are not included in the selection though, but as they are also unselectable and skipped in keyboard selection, that would be okay, too, I think. I'm just continuing my search in that direction to see what I can find.
Please ask in the comments if anything is unclear.

Related

Changing the data in a specific area of a window, Caliburn.Micro, WPF

Here is my need. I think a user control is what I need but I am not sure if its the best or even how to use it.
What I have. My main window has a menu with a "help" menu. When you click help, a new window opens, I have a column, At the top of the left column has a drop down box of "Major Titles", a ListBox below that that populates based on the combo box selection. This will be about 25% of the window width. All this works.
When I select an item in the list box a page,contentControl or user control is displayed to the right with verticle scroll bars so the window does not need to resize, the information I display that changes based on the list box selection will have only visuals like text block, label, images. There will be no user interaction with the changeable pages Just formatted Data.
What would be the best way to approach this? Can anyone offer an easy example?
I was thinking of using a user control and change the user control based on the selected list box item.
Ok, I got this figured. After reading a lot of posts and blogs. Seems people sometimes want to make things more complicated then they actually are.
What I wanted, a permanent list box on the left 1/6 of the window. The list box contained string names for "help subjects". On the right 5/6 of the screen I added a groupbox with header and in group box I added a usercontrol. The content of the control is bound to a property called 'ActiveView'. The list box selected value property is bound to 'SelectedListItem' property.
When you change it set 'SelectedListItem' a method is called 'SetActiveControl'. SetActiveControl has a switch/case that sets like in the example:
``Case "Setup":
ActiveView = new SomeSelectionViewModel();
Break;
I have created a user control in a folder inside the Views folder called HelpControls, I also created the same folder in ViewModels. I have classes matching the user controls and everything is bound together.
Ultimately when you click the list box item, the associated ViewModel is called and in turn populates the user control on the window with the appropriate data.
I need to later look into, using one ViewModel for all the controls, I know that can be done using Cal:Model.View = ViewModel name. In the xaml of the control. I'm just not sure how to call the appropriate user control view when an item is selected. Either way this would become a view first design and I thought I read, Caliburn. Micro was intended as a ViewModel first design.

How to show additional info in a vaadin combobox selection list?

I'd like to have a combobox where there is a lot of information in the list to select from or search but only parts of it are shown after selection.
For example when the user starts typing "raf" the combobox should show a list like this:
RA - Raffael (raffael#example.com)
HU - Hugo (hugo#rafferty.xyz)
After selecting the entry "Raffael" only "RA" should be shown in the combobox.
I need that because of the limited space for the combobox in my application. So the combobox should not be wider than needed to hold some characters but the list to select from may be much wider. Is there an easy way to achieve that? Or which function i have to overwrite in combobox to set the text line after the selection?
Thanks
This is not possible with a standard Vaadin ComboBox without custom client side coding.

datagridview background color obfuscated / dirty when selected rows

I've been looking for some hours but haven't found a solution about this issue.
I'm using the .NET 4 DataGridView in WinForms and it's presenting me some issues with selected rows background colors.
Rows become like dirty when selected, and any properties of the window change. For example: when another window moves over the grid, the hidden part of the field becomes unreadable.
I'm posting an image explaining this situation better than my poor English does.
As the figure shows, selected rows with lightblue forecolor became dirty when another windows passes over them. You will see that only selected ones become that way, as the other not selected green row wont happen that.
I've figured out that there is a SelectedBackGround property that allows me to change the color of the selected rows, wich is not the same as the default backcolor.
That solved my problem.

Master/Detail UI Best Practices?

We have a WPF app that has a master/detail window, both being WPF Datagrids. When you select a row in the upper datagrid, the details are shown in the lower datagrid. I was wondering if there are any best practices from a UI perspective on how to deal with things such as:
When the window first opens, no datarow is selected in the upper datagrid, and so no data can be displayed in the lower grid. Is this normal? Or is there typically an initial (top) row selected in the upper datagrid?
When a row is selected and then deleted - does another row become the selected row? Or are you going to go to a no row selected state?
If multiple rows can be selected, when happens in the lower datagrid? Show the last one selected? Or if delete is selected for these multiple objects, where is focus set? Or what row is selection?
I know there are a lot of different ways these things might be handled depending on how the app is written, but I wondered if there is some standard best practices? Or if there is some default operations for how the WPF datagrid might handle these cases?
thanks!
Bill
I think the first two considerations can come down to preference. I'd prefer to have the first row selected and its details shown when the window first opens -- this tells me, as a user, how this window works. Not sure how it works in WPF, but in Windows Forms, the datagridview pre-selected the top row by default (and getting it to stop doing that requires tricks).
When I remove a row, I personally prefer to go to a "no row selected" state, but I don't have much to back that up with in terms of "this is why you should do it". I just like seeing the empty "detail" view and lack of selection as confirmation that I did successfully remove the selected row.
The last point, however, I think is more clear-cut. If you have a master/detail relationship in views, you should not allow multiple selection. If you need the user to be able to perform actions on multiple rows of the master gridview, you can add some checkboxes to the rows to allow the user to pick a subset of rows to act on. But for the purposes of showing details, only one row must be selected at a time.

Is there a way in the WPF Toolkit datagrid to have a header below the column headers but above the first row

I looking for a way to create an area that indicates a user is at the top row of the WPF Toolkit datagrid. (Showing the scrollbar scrolled down is not enough for the user). I need something that sticks out and says "this is the top row" basically. Messing with the entities that that the grid is bound to will not work for me because I have several grids with different filters over the same collection of entities. Also this underlying collections is changing while the app is running.
Is there a way to add a control of some sort between the column headers and the first row of the datagrid? Maybe a separator of some sort?
Thanks!
Jon
A possible solution is to create your own Template for the column headers with ColumnHeaderTemplate and show whatever you need in there. This way you'll have full control of what your header looks like.
Another hackish solution could be you change the Style of the header to achieve the desired effect, like setting the bottom margin to a higher value so that there is a space between the header and the first row.

Resources