Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to use a ComboBoxEdit whose choices are different for each cell in the grid

$
0
0

There are two ways to accomplish this task: via filter criteria and by using a multibinding approach. Let me explain theses approaches in detail.


1) Filter criteria

The main idea is to dynamically construct a filter by using the selected value of the first column in the grid. So, items in the ComboBox editor will be filtered automatically according to the filter's value. In this case, it is necessary to create a converter (which implements the IValueConverter interface) in the code-behind file.


2) Multibinding approach.
You can also resolve this problem by using the multibinding approach. Specify multiple bindings in a MultiBinding object and create a converter (which implements the IMultiValueConverter interface) to produce a final value for the binding target property based on values of those bindings.

Question Comments

Added By: XempleX at: 4/5/2013 1:10:41 AM    

The problem with this solution is that the ItemsSource is used by all the rows in the grid. This means that, if you've already selected a colour for "Make1", then while you're selecting a colour for "Make2", the colours in the "Make1" rows disappear! In fact, in the example below, they never reappear because the HiddenEditor event hasn't been handled. So this solution is only useful when you only have a single "Make" in the grid (which means that it isn't really useful at all).

Added By: Elliot (DevExpress Support) at: 4/16/2014 12:54:00 AM    

Please accept my sincere apologies for the delayed response. I re-created this code example in November, 2013. Currently, this code example works correctly for this situation. You can download the new version of this code example from our website and check it. If you experience any further difficulties, do not hesitate to contact us again. We are here to help you.

Added By: Johnson Ho at: 7/6/2015 3:04:21 PM    

Is there an updated working example/project of this available?  Thanks.


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>