UserControl instead of details GridView - winforms

I need a big customization on how the standard details grid view in DevExpress XtraGrid is displayed.
What I need to achieve is when user expands the 'master' row, I need to display details view which should also contain some additional controls outside the grid like buttons etc.
So basically, when user expands the 'master' row, I need to show my own UserControl, which would include the details GridView itself and also my buttons etc.
Anybody tried to accomplish similar functionality?
Any hints where should I start?

Related

Is it possible to add two or more repository controls in devepxress grid control

Hey i am dealing with winform(c#) application. i am using Devexpress Grid Control.
Is it possible to have two or more repository controls in grid control column for edit purpose.
eg.. say like a textbox and combo box in a grid column.(this is possible in web application by adding item templates to the grid column)
Is this possible or any other way to get this done?
You can set the GridColumn.ColumnEdit property to specifying the editor used to edit a column's value

How to change Grid Content?

I am asking for a programming approach.
This is my problem:
I have a WPF window, with a ComboBox at the top.
When user select the item in combobox, depends on the selection, the Grid below it will show a corresponding element, for example: if use choose Display from combobox, then the element in Grid will change to a ListView; and when user choose Add from combobox, the element in Grid will change to a form(textboxes).
Should I create several Grid, collapse them, and show them only when user make selection? Or any other more brilliant ideas?
Thanks.
Put a UserControl in the cell, and set its Content according to the control selected in the ComboBox.
There can be two ways:
You add one panel containing the controls required for each of the items in the combobox. You can hide all of them and on SelectedIndexChanged, you can show the appropriate panel. This will need more memory, but the implementation is simpler.
The other way will be to have a single panel and render the controls in run time on SelectedIndexChanged. This will need less memory, but will be complex to implement. Also rendering on run time might need some additional time (so the throughput).
What you can do is place a Panel(Like Grid, DockPanel) below the combobox and based on it's selection, dynamically add/remove controls in the panel.
For ex: If the user selects Display, then, remove all the child elements of the Panel and add a GridView.If Add is selected, remove all child elements and add a TextBox.
After adding, attach an event handler in code behind to perform the action you would want to perform.

Dynamically changing a WPF ListView between one that contains a GridView with column headers and another view that doesn't

I'm not quite sure how to go about this so any advice would be much appreciated.
I have a ListView whose default implementation is using with column headers. At runtime in the program I would like to be able to click on a button at runtime to change the view so that the list view loses the GridViewColumn headers and implements a new style using one of my own data template.
Then I would also like the ability to click the button and change the ListView back to a grid view with column headers.
Can anyone point me in the correct direction of how to go about this?
Thanks
Since ListView.View is dependency property, you can bind it to something on your VM via converter.
Microsoft has a sample that demonstrate how to create a ListView control that displays data in multiple view modes, which include the GridView and other custom view modes.
Search for ListView with Multiple Views Sample in the WPF Documentation Sample page.
http://archive.msdn.microsoft.com/wpfsamples
Here is a direct link to download the sample:
http://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=wpfsamples&DownloadId=7766

I want to create a combobox in wpf

I want to create a combobox with some style. I dont want old dropdown what we are getting. I want some new dropdown which looks very nice. Is there any way to create a dropdown like that.
Plz give me suggestions
Check this link out on msdn. This is the actual control template for the combo box. You can copy and paste this into your application (within your app's Resources).
Create a form and slap a combo box on it with some data in it. Then start changing the control template and view the results. Start off simply by changing colors and adding borders around elements to see what controls which part. Then you can start switching out larger parts of the template to match what you're looking for.
one can start with the standard combobox, and then use various controls and styles to change the look and feel of the control, and it's corresponding drop down.

WPF DataGrid - Setting RowDetails programmatically

I'm using the WPF DataGrid, and I'd like to know if there is any way I can access the DataGridRow's RowDetails programatically.
For example, when the user selects the row, I'd to grab some data from somewhere (say, a database), and display it in the RowDetails.
All of the examples I've seen tend to just display some extra bound data that isn't included in the columns for the row.
You could display some extra data but lazy-load it on SelectionChanged.
It usually is not easy to work directly with the WPF controls, they are not really meant to be used without a backing databound model.
If you have all the data in list of objects (or something similar) then you can do all sorts of fun things. I'm using a WPF Datagrid in this manner, and when a user selects a row, I think populate an editor control above the grid with the row item plus additional details.
That said, there's nothing stopping you from adding in additional information in the grid that's normally hidden and a trigger on row selection to show the additional data
you can use the following code
DataRowView row = (DataRowView)MyDataGrid.SelectedItem;
string strName = row.Row["Name"].ToString(); //where "Name" is the column name

Resources