views:

94

answers:

2

Hi,

I would like to hear your thoughts and ideas about this one.

in my application i have controls that are binded to objects properties. but.. the controls always looks like that:

a check box, label that explain the settings and then the edited control (for ex: text box) when unchecking the checkbox i disable the text box (using binding) when the checkbox is unchecked i want the property to contain null, and when it is checked i would like the property to contain the text box's text.

Of course text box can be NumericUpDown, ComboBox, DatePicker etc..

Do you have any smart way of doing it using binding or do i have to do everything on code;

I really would like to a build a control that supports that and re-use it all over

Ideas?

Thanks,

A: 

The answer depends on the UI toolkit you're using - Windows Forms? WPF? ASP.NET?

Judah Himango
You're right, i forgotit's wpf
A: 

It seems like you'd want to bind to a custom object, which had a 'UseNull' property on it, as well as the underlying property.

The 'real' control for non-null values could be then picked using a TemplateSelector.

At least that's how I'd initially attack that problem.

kyoryu