开发者

Is it possible to name something in XAML without getting a field for that object?

I use x:Name to name an element in XAML because I want to be able to reference it using Storyboard.TargetName but everything that has x:Name set also gets a field generated in the code-behind. Is it possible to target an element with Storyboard.TargetName without getting a field (which FxCop gives a warning abou开发者_开发问答t unused private code for).

Thanks.


Wouldn't it be more reasonable to just suppress the FxCop warning? This is obviously a false positive since it's generated code.

Edit: actually, what you need is a project suppression file (search for "SupressMessages.cs")


Perhaps it helps if you set Visibility="Hidden", so it's not there but you can use it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜