ReSharper + Silverlight + DataTemplate

So normally in WPF you'd delcare a XAML data template like so:

<DataTemplate x:Key="MyDataTemplate">
    <TextBlock Text="{Binding SomeText}" />
</DataTemplate>

And Resharper would complain that it could not find the SomeText property.  So you'd add a DataType attribute:

<DataTemplate x:Key="MyDataTemplate" DataType={x:Type MyViewModel}>
    <TextBlock Text="{Binding SomeText}" />
</DataTemplate>

and all is well from a code analysis stand point.  However, Silverlight lacks the DataTemplate.DataType property so ReSharper doesn't know what to do (aside from barf all over my completely correct data template).  Is there a way to make Resharper happy in this scenario?  Do I just need to wait Silverlight 5?

1 comment
Comment actions Permalink

Hello,

Have you tried specifying design-time data context (http://msdn.microsoft.com/en-us/library/ff602277(v=vs.95).aspx)?
Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

So normally in WPF you'd delcare a XAML data template like so:

<DataTemplate x:Key="MyDataTemplate">
<TextBlock Text="{Binding SomeText}" />
</DataTemplate>
And Resharper would complain that it could not find the SomeText
property.  So you'd add a DataType attribute:

<DataTemplate x:Key="MyDataTemplate" DataType=>
<TextBlock Text="{Binding SomeText}" />
</DataTemplate>
and all is well from a code analysis stand point.  However,
Silverlight lacks the DataTemplate.DataType property so ReSharper
doesn't know what to do (aside from barf all over my completely
correct data template).  Is there a way to make Resharper happy in
this scenario?  Do I just need to wait Silverlight 5?

---
Original message URL:
http://devnet.jetbrains.net/message/5348260#5348260



0

Please sign in to leave a comment.