views:

75

answers:

2

I dislike WPF's inability to interpret text in a case-insensitive way.

Are there any tools (i.e. VS plugins) out there that will take my VB .NET code and handle the case-sensitivity issues for me?

Edit: Now with examples.

Input:

<Dockpanel DockPanel.Dock="Bottom">
        <Label Content="(c) blahblah" HorizontalAlignment="Left"  Name="Label2" VerticalAlignment="Bottom" Opacity=".75" Background="White" DockPanel.Dock="bottom"/>
    </DockPanel>

Output:

<DockPanel DockPanel.Dock="Bottom">
    <Label Content="(c) blahblah" HorizontalAlignment="Left"  Name="Label2" VerticalAlignment="Bottom" Opacity=".75" Background="White" DockPanel.Dock="Bottom"/>
</DockPanel>
+1  A: 

I don't think that WPF is the problem here.

If you need to validate data and remove case from the problem, then convert all your strings to Upper or Lower before comparing.

If you need to change the way that a TextBox functions in WPF, either create your own inherited TextBox and override the Text property or modify the setters in your bound properties to modify any value it receives such as

public string Name
{
  get { return this._name; }
  set 
  { 
     this._name = value.ToUpper(); 
     OnPropertyChanged("Name");
  }
}

Without more information about the problem, I am not sure what else to suggest.

benPearce
+4  A: 

This is kind of like trying to use C# without ; or XAML without angle brackets. Case sensitivity is an intrinsic part of the XAML language and the WPF Binding system. If your VB code is causing problems when you're using it with WPF turn Option Strict on and fix the inconsistent casing in your code.

John Bowen
Just because it's a part of the language doesn't mean it's not worth trying to fix.
Zian Choy
That's true. So use the fix for VB by turning on Option Strict.
John Bowen