Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2387
Data binding to ValueConstraint's
posted

I know that it is not possible to data bind directly to a ValueContraint because it is an Attached Dependency Property, so I though I might look for a workaround.  What I have done is extended the editor and added my own property which does support data binding.  Then in the callback for that property, go in and add the ValueContraint that I want set:

private static void OnNumberRspParamChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
  NumberRspParam numberRspParam = e.NewValue as NumberRspParam;
  if (numberRspParam != null)
  {
    d.SetValue(ValueConstraint.MaxInclusiveProperty, numberRspParam.MaxValue);
    d.SetValue(ValueConstraint.MinInclusiveProperty, numberRspParam.MinValue);
  }
}

This doesn't seem to have any effect.  I am wondering if there is some way I can make it work.  The issue is I am doing a dynamic form system where these parameters are not known until runtime.

Sam