DataBinding value to expression that looks at multiple object values
-
So I'm trying to find a way to bind CheckBox::Enabled to an expression that looks at a unary operation of a column in two rows of a DataTable that I'm pulling using an XSD generated by VS2005. I know I can do this through a validation event, however I'd like to do it through the designer if at all possible. Pretty much I'd like to bind checkboxobject.Enabled to: (someDataRow["column"]==value || nextDataRow["column"]==value) Any thoughts on how I might be able to do this?
-
So I'm trying to find a way to bind CheckBox::Enabled to an expression that looks at a unary operation of a column in two rows of a DataTable that I'm pulling using an XSD generated by VS2005. I know I can do this through a validation event, however I'd like to do it through the designer if at all possible. Pretty much I'd like to bind checkboxobject.Enabled to: (someDataRow["column"]==value || nextDataRow["column"]==value) Any thoughts on how I might be able to do this?
Without knowing what the conditions are to either turn on or off the checkbox. If its where value equals true....
if(someDataRow['column'] == true || nextDataRow['column'] == true) checkbox.Enabled = true; else checkbox.Enabled = false;
or you could use...checkbox.Enabled = someDataRow['column'] == value ? true : false; if(checkbox.Enabled == false) checkbox.Enabled = nextDataRow['column'] == value ? true : false;
There are many ways to accomplish this task, good luck.Just because we can; does not mean we should.
-
So I'm trying to find a way to bind CheckBox::Enabled to an expression that looks at a unary operation of a column in two rows of a DataTable that I'm pulling using an XSD generated by VS2005. I know I can do this through a validation event, however I'd like to do it through the designer if at all possible. Pretty much I'd like to bind checkboxobject.Enabled to: (someDataRow["column"]==value || nextDataRow["column"]==value) Any thoughts on how I might be able to do this?
BAH!! I've already done this. I can just set a filter in a binding source and bind Enabled to any column containing a positive integer value in that source. Thanks for your input KK. If I wind up putting code in the validation event, that's probably what I'll do.