4

ReSharper's complaining about some of my XAML with the following error:

'Name' attribute is not allowed here because type 'FlashingTextBlock' is implemented in the same project. Use 'x:Name' instead

What's the problem here? Should I do what it says?

Roger Lipscombe
  • 85,268
  • 51
  • 226
  • 362

2 Answers2

3

See an excellent explanations in this answer, and decide for your own ;)

In WPF, what are the differences between the x:Name and Name attributes?

Community
  • 1
  • 1
Arcturus
  • 26,107
  • 10
  • 91
  • 105
0

Does FlashingTextBlock have a System.Windows.Markup.RuntimeNameProperty attribute?

According to "Windows Presentation Foundation Unleashed" by Adam Nathan:

... you can simply set its Name property to a string rather than use the x:Name syntax. You can use either mechanism, but you can't use both simultaneously.

richj
  • 7,439
  • 3
  • 31
  • 48
  • No, it doesn't have a `RuntimeNameProperty` attribute. It's a `UserControl`; presumably it inherits `Name` from `FrameworkElement`? – Roger Lipscombe May 17 '10 at 09:59
  • Yes - I found a reference here: http://msdn.microsoft.com/en-us/library/system.windows.markup.runtimenamepropertyattribute%28VS.85%29.aspx – richj May 17 '10 at 11:31