What is the easiest way to generate a Valid x:Name?

Posted by just in case on Stack Overflow See other posts from Stack Overflow or by just in case
Published on 2010-05-18T16:38:09Z Indexed on 2010/05/18 16:40 UTC
Read the original article Hit count: 199

Filed under:
|
|
|
|

I am generating some Xaml based on some other source of input. In some cases I am generating x:Name values but they have invalid characters. I found this article on MSDN:

XamlName Grammar

Which describes the grammar of a x:Name tag but doesn't tell me how to actually apply this. Clearly there is some code to validate this name at runtime but what is the easiest way to actually fix up a string with invalid characters?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#