简体   繁体   中英

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

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 ax: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?

Turns out it made the most sense to just drop all of the x:Names and not generate them. We don't really need to dig around inside for particular elements afterall. We still have to generate file names and Class names but that's a bit easier of a problem I think.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM