Filtering GridViewComboBoxColumn in RadGridView for WPF

Posted on Dot net Slackers See other posts from Dot net Slackers
Published on Fri, 09 Apr 2010 00:00:00 GMT Indexed on 2010/04/09 17:03 UTC
Read the original article Hit count: 447

Filed under:

The GridViewComboBox column is used to display lookup data in user friendly manner. For our demo we bind RadGridView for WPF to a collection of custom Location objects.

countries_grid

As you may notice – each location has a selectable Country field.  Here is the underlying ‘data model’:

public class Location {  public int CountryID { get; set; }  public string CityName { get; set; } } public class Country {  public int ID { get; set; }  public string Name { get; set; } }  

The location object contains the integer CountryID. Each CountryID corresponds to a certain country and with the help of GridViewComboBoxColumn we see some human readable country names instead of the underlying numeric IDs.

Now The Problem:

bad_filter

Unfortunately the filter control does not know that our Country IDs are associated with Country objects, so it displays the ...

Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.



Email this Article

© Dot net Slackers or respective owner