WPF Reflections

Oct 26 2007   1:25PM GMT

Removing localisation attributes from xaml

Mark Shurmer Profile: MarkWPF

Should you find yourself in a position where you have localised your WPF application, and then wish you hadn’t, you will find yourself needing to remove all the attributes put in by the localisation process.

For those who have yet to experience that, the attribute that is added is x:Uid, like so:

<TextBlock x:Uid=”txtMyTextField” />

The awkwardess is presented by the fact that you want to not only find the attribute in every single xaml element, but to remove the value of the attribute as well.

The first thought I had, no doubt like many others, was that seems pretty basic functionality for search and replace in any xml editor. So I tried my favourite one – no good.
Therefore I tried lots, from basic to industry leaders – even some that half promised on their websites didn’t
:-(

So, I fell back to the last resort which was a regex search and replace in visual studio – which worked, though it’s a whole lot scarier!
Here it is for those looking:

x\:Uid=”[:a\:_]*”

which includes the colon and the underscore in the search pattern

 Comment on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: