Forcing the binding expression updating

31 12 2010

If you need to force the binding expression updating, defined on a Silverlight control, you can use the following code.

public static void UpdateBindingExpressions(Control control)
{
  if (control != null)
  {
    Type controlType = control.GetType();
    FieldInfo[] fieldsInfo = controlType.GetFields(BindingFlags.Public | BindingFlags.Static);
    if (fieldsInfo != null)
    {
      foreach (FieldInfo fieldInfo in fieldsInfo)
      {
        DependencyProperty depProp = fieldInfo.GetValue(null) as DependencyProperty;
        if (depProp != null)
        {
          BindingExpression bindingExpression = control.GetBindingExpression(depProp);
          if (bindingExpression != null)
          {
            bindingExpression.UpdateSource();
          }
        }
      }
    }
  }
}




Pack URIs in WPF

31 12 2010

If you are looking for Pack URIs in Windows Presentation Foundation you can read this article.






Hello world!

31 12 2010

Welcome to DotNetSlang.