I need to add a rowheader to a Listview GridView. it needs to act like a datagrid rowheader, sop it should be freezable.
is thsi possible? can anyone show me some source code to do this?
Thanks
The GridView do not have rowheaders but you can style the first column differently than the rest. Implementing freezing will require some innovative use of a scrollviewer. Can't you just use the DataGrid which has RowHeaders?
DataGrid Class
Related
I was wondering, is it possible to display a grid in a comboBox as its selectedValue (or displayMemberPath) ?
I wanted to do something like that :
It's a screen from Telerik's comboBox, but I wish to do the same in WPF only. I already use a grid inside the dropdown and it works pretty well, and I'd achieve something cool if I could display many rows as a selectedValue. I supposed I'd use a grid but applying a grid in the displayMemberPath style doesn't really work.
My comboBox is inside a DataGridTemplateColumn but I don't think it matters, just saying.
Thanks !
Is it possible to have a listbox displaying its items with a control template to change their look in the listbox and also have a canvas displaying the listboxItems with another look?
To be more accurate,
I have a UserControl named InfoControl and another named DesignerControl with the same DataContext: a DesignerVM which contains an ObservableCollection of CurveVM.
In my InfoControl, I have a listbox with its items binded to the OC and shown as stackpanels using a template.
Now I want to display my items in the DesignerControl (canvas) but with another look.
Should i have to create another listbox and synchronize it with the first one or is there a way to achieve my goal?
Two controls shouldn't share a listbox. Instead, make two separate listboxes and bind them to the same ItemsSource or DataContext. Use a DataTemplateSelector to control which template is used.
Edit: And welcome to StackOverflow :)
for an overview, an MVVM project in built in WPF.
Basically in my xaml, I have a datagrid bound to a dataview. When my service populates the dataview I get a dynamic table with an arbitrary number of columns.
For each column in the datagrid, I have created a headertemplate which contains a combobox which is bound to an Observable<Dictionary<string,BusinessEntity>> object as its item source in the xaml. Figuring out the combobox is another issue but I am trying to just populate data grid first, then worry about binding the combobox correctly.
anyways the only solution I have somewhat though of was to turn on autogeneratecolumn and then replacing all the headers with a combobox in the codebehind, but then I have issues trying to bind the combobox in the codebehind correctly and it doesn't feel MVVM if I have to create all those comboboxes there.
You can handle the AutoGeneratingColumn event to customize the auto generated column's header template.
I'm trying to migrate to WPF and evaluating the DataGrid. First, I tried to make the DataGrid look and feel similar to the old DataGridView. The problem is that the scrollbars in DataGrid only cover the scrollable area. That means, the column and row header areas are shown in background color, which looks ugly to me. How can I make the scrollbar to extend to the edge of the control? Is there is property in DataGrid for this?
By the way, did anybody create a style for DataGrid to make it have a similar look and feel of DataGridView (e.g. DataGrid grid line is black by default, Row header doesn't look cool, and it's missing the selection triangle, and the scrollbar problem as described here, and so on)
EDIT: You can see a screenshot.
How to create a GridView like view to the WPF ListView if i dont know the Column names at the design time because the collection will be created at runtime and the collection will be of type DataTable and it may contain a no.of columns.I can do it with WPF DataGrid but i want to achieve this with WPF ListView and I want to Achieve this without code behind.
You can add columns dynamically to a ListView by using Attached Properties. Check out this article on the CodeProject it explains exactly that...
WPF DynamicListView - Binding to a DataMatrix