We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to implement a discriminated union with each row bound to a different field of the data source?

Thread ID:

Created:

Updated:

Platform:

Replies:

105694 Nov 13,2012 04:24 PM UTC Dec 4,2012 10:38 AM UTC WPF 1
loading
Tags: GridControl
Hamish Gunn
Asked On November 13, 2012 04:24 PM UTC

Let's say I have a data source of items each with a type field string typeValue that can contains "String", "Int" and "Bool".  I have 3 fields string stringValue; int intValue; bool boolValue.

I want a grid with two columns "Type" bound to typeValue and a "Value" column bound to either stringValue, intValue or boolValue depending on the value in typeValue.

e.g. a four row grid:

"String", "This is a string value bound to stringValue."
"String", "This is another string."
"Bool", false             <-- displayed as a tickbox
"Int", 16000

How do I do this with the data bound grid?  I can see I need a bound column for the type and an dynamically bound column .  For each row I would dynamically set the binding and display properties depending on the type.  For example the boolean row above would change the cell to a tickbox and bind it to boolValue.


Is this possible?


Kannan R [Syncfusion]
Replied On December 4, 2012 10:38 AM UTC

Hi Hamish,

 

Thanks for using Syncfusion products.

 

We have prepared sample based on your requirement and it can be downloaded from below location.

 

Sample Location: 105694ForumSample.zip

 

Please let us know if you have any queries.

 

Thanks,

Kannan.R


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;