Hi,
I have a DataForm with AutoGenerateFields="True". In the AutoGeneratingField event handler I want to set a binding on the IsReadOnly property for some of the fields, so that when the FromProfile property is checked, those fields will be set as ReadOnly. The strange thing is that the binding only works if FromProfile is True when the AutoGeneratingField is fired. The DataField's ("Port", "Protocol" and "Interface") is set ReadOnly whenever the "FromProfile" DataField is checked. If FromProfile is False at the time the binding is set up, it doesn't work.
The AutoGeneratingField event handler looks like this:
01.
if
(e.DataField.Label.Equals(
"Port"
) || e.DataField.Label.Equals(
"Protocol"
) || e.DataField.Label.Equals(
"Interface"
))
02.
{
03.
var binding =
new
Binding(
"FromProfile"
)
04.
{
05.
Mode = BindingMode.OneWay,
06.
UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged,
07.
};
08.
e.DataField.SetBinding(DataFormDataField.IsReadOnlyProperty, binding);
09.
}
Any idea why it doesn't work?
Regards,