Ejemplo n.º 1
0
 /// <summary>
 /// Removes the <c>Microsoft.VisualStudio.Platform.WindowManagement.StringUppercaseConverter</c> Converter
 /// from the binding.
 /// </summary>
 /// <remarks>
 /// Seriously.
 /// </remarks>
 /// <param name="textBlock"></param>
 private static void RemoveOutrageousConverter(TextBlock textBlock)
 {
     BindingExpression bindingExpression = textBlock.GetBindingExpression(TextBlock.TextProperty);
     if (bindingExpression != null)
     {
         Binding binding = bindingExpression.ParentBinding;
         if (binding != null)
         {
             // A binding's converter can't be changed after it has been used.
             // Create a new binding without a converter at all.
             Binding betterBinding = new Binding();
             betterBinding.Path = binding.Path;
             textBlock.SetBinding(TextBlock.TextProperty, betterBinding);
         }
     }
 }