Binding cutsom type value to Control
-
Hi all. Is exists way to binding cutsom type value to Control through databinding Example
//My cutom type
public class CLASSIFIED
{
public CLASSIFIED(double Val)
{
this._value = Val;
}private double \_value; public static implicit operator CLASSIFIED(double Val) { return new CLASSIFIED(Val); } public static implicit operator double(CLASSIFIED CLASSIFIED) { return CLASSIFIED.\_value; } } //My Source provider class SourceProvider { CLASSIFIED Index {get{...} set{...}} } //My binding ... control.DataBindings.Add("EditValue", \_sourceProvider, "Index"); //This way data binding not understand what binding value have double type!!! ...
I know what i can do it through IFormatProvider interface like what : control.DataBindings.Add("EditValue", _sourceProvider, "Index", null, null, _myFormatProvider); But what about other way, derive my custom type from AN INTERFACE what DataBindings.Add(...) recognize and format my custom type value automaticaly????
public class CLASSIFIED : ISomeInterfceWhatDataBindingRecoginze { .... } }
THANK!!! -
Hi all. Is exists way to binding cutsom type value to Control through databinding Example
//My cutom type
public class CLASSIFIED
{
public CLASSIFIED(double Val)
{
this._value = Val;
}private double \_value; public static implicit operator CLASSIFIED(double Val) { return new CLASSIFIED(Val); } public static implicit operator double(CLASSIFIED CLASSIFIED) { return CLASSIFIED.\_value; } } //My Source provider class SourceProvider { CLASSIFIED Index {get{...} set{...}} } //My binding ... control.DataBindings.Add("EditValue", \_sourceProvider, "Index"); //This way data binding not understand what binding value have double type!!! ...
I know what i can do it through IFormatProvider interface like what : control.DataBindings.Add("EditValue", _sourceProvider, "Index", null, null, _myFormatProvider); But what about other way, derive my custom type from AN INTERFACE what DataBindings.Add(...) recognize and format my custom type value automaticaly????
public class CLASSIFIED : ISomeInterfceWhatDataBindingRecoginze { .... } }
THANK!!!This[^] might be a good place to start looking.
El'Cachubrey wrote:
derive my custom type from AN INTERFACE
IDatatSource[^] perhaps?
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine Allen