我正在根据其他一些输入源生成一些 Xaml。在某些情况下,我生成 x:Name 值,但它们包含无效字符。我在 MSDN 上找到了这篇文章:
XamlName Grammar
其中描述了以下语法ax: 名称标签,但没有告诉我如何实际应用它。显然,有一些代码可以在运行时验证该名称,但是实际修复包含无效字符的字符串的最简单方法是什么?
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?
发布评论
评论(1)
事实证明,删除所有 x:Names 而不生成它们是最有意义的。毕竟,我们真的不需要在内部挖掘特定元素。我们仍然必须生成文件名和类名,但我认为这是一个更容易的问题。
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.