473,324 Members | 2,239 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

WPF: Combobox as a header in gridview

ER
Hi Guys

Started having a play with WPF and need some direction with a grid.

I am trying to build a list of products in a grid view with combox boxes as
column headers that allow filtering and sorting (similar to lists in excel).
Pic attached:

As a bonus, I would like the the columns to be able to be re-ordered at run
time.

A column might contain Suppliers, so the Combobox would contain items like
the following:
All Suppliers
--
Sort Asc
Sort Desc
--
Supplier1
Supplier2
Supplier3
etc

Selecting Supplier2 would filter the grid and show only those products for
that supplier.

I have been looking at the ColumnHeaderTemplate but have a way to go

Any guides greatly appreciated.

ER

Start of some code below:
<DataTemplate x:Key="myHeaderTemplate">

<DockPanel>

<ComboBox ItemsSource="{Binding}" Width="100" />

</DockPanel>

</DataTemplate>

<ListView ItemsSource="{Binding}" x:Name="lstStockItems" Grid.Row="1"
Foreground="#FFFFFFFF"
GridViewColumnHeader.Click="GridViewColumnHeaderCl ickedHandler">

<ListView.View>

<GridView AllowsColumnReorder="true" ColumnHeaderToolTip="Stock Items"
ColumnHeaderTemplate="{StaticResource myHeaderTemplate}">

<GridViewColumn DisplayMemberBinding=

"{Binding Path=StockItemID}"

Header="StockItemID" Width="100"/>

<GridViewColumn DisplayMemberBinding=

"{Binding Path=Name}"

Header="{Binding Path=Name}" Width="100"/>

<GridViewColumn DisplayMemberBinding=

"{Binding Path=SupplierName}"

Header="{Binding Path=SupplierName}" Width="100"/>

<GridViewColumn DisplayMemberBinding=

"{Binding Path=StockItemDepartmentName}"

Header="StockItemDepartmentName" Width="100"/>

</GridView>

</ListView.View>

<ListView.Background>

<LinearGradientBrush EndPoint="0.418,0.009" StartPoint="0.42,1.7">

<GradientStop Color="#FF000000" Offset="0"/>

<GradientStop Color="#FF453F3F" Offset="0.545"/>

<GradientStop Color="#FF180404" Offset="1"/>

</LinearGradientBrush>

</ListView.Background>

</ListView>


May 4 '07 #1
0 2779

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: wallermj | last post by:
I am an inexperienced asp.net user starting my first app in asp.net. I need to have a combobox field in my gridview whose data is filtered by a field in that row. More specifically, I am to...
9
by: Jakob Lithner | last post by:
1) I have a DataGridView with edit capability. But in some columns I want to limit the input with a DropDownList. There is no inbuilt column for DropDownLists so I intended to add one myself. I...
0
by: ER | last post by:
Hi Guys Started having a play with WPF and need some direction with a grid. I am trying to build a list of products in a grid view with combox boxes as column headers that allow filtering and...
0
by: Oleg Ogurok | last post by:
Hi there, I have a WPF combobox with two values "Male" and "Female". It seems by default the control supports mnemonics, e.g. if I press "M" on keyboard, it sets the current ComboBoxItem to...
0
by: commanderjason | last post by:
I am converting a .net winforms app to wpf I make use of the System.Windows.Forms.ComboBox.FindString but am unable to find anything that accomplishes that in the...
7
by: Jeremy | last post by:
I'm getting started with WPF & am converting a small asp.net app that uses a couple of dropdownlists. They have the useful feature of holding a string and also another (index) value in each item. ...
1
by: Rick | last post by:
I'm using WPF with net 3.5 to load the ItemsSource of a combo box from an xml file. The xml is setup like this: <profiles> <profile> <profilename>First profile</profilename> ... </profile>
0
by: Brandon | last post by:
Hi there... I got a WPF project that I am trying to select a ComboBoxItem in a ComboBox based on a string from the selected ListView item in the project... This ComboBox is unbound now and the...
0
by: pavanip | last post by:
Hi, I am facing problem with combobox in gridview.I have used combobox in gridview and i am binding data to gridview combobox from database. If i click 2 times on combobox then it is showing the...
0
by: marisenthil | last post by:
i am created windows application. i have a gridview in form1 with combobox column. using binding source binded data from the database to gridview except combobox column. i used separate binding...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.