| Reporter |
|
|---|---|
| Created | Apr 8, 2018 5:10:42 PM |
| Updated | Apr 8, 2018 5:13:40 PM |
| Subsystem | XAML |
| Assignee | Alexander Shvedov (shvedov) |
| Priority | Normal |
| State | Submitted |
| Type | Improvement |
| Fix version | No Fix versions |
| Affected versions | No Affected versions |
| Fixed In Version ReSharper | Undefined |
| VsVersion | All Versions |
ReSharper supports attaching Blend's d:DataContext attribute to more elements than the attribute was originally designed for, including ControlTemplate and Style which do not support any way of specifying data context (DataTemplate has DataType, d:DataContext isn't required in this case). However, using this feature causes Visual Studio to produce IntelliSense errors on every usage:
Property 'DataContext' is not attachable to elements of type 'ControlTemplate'
According to a post on StackOverflow, ReSharper's developers were searching for solution for over six years. Apparently it wasn't found.
I propose the following solution:
- Add support for alternative XML namespace of
http://schemas.microsoft.com/expression/blend/2008, likeurn:jetbrains:resharper:xaml. It could then be used instead ofxmlns:d="http://schemas.microsoft.com/expression/blend/2008"or in addition to it. It should not cause any issues with compiling, it can just be added toxmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorableattribute just like Blend's namespaces.
Adding support for it is currently as simple as interpreting some other namespace as http://schemas.microsoft.com/expression/blend/2008. This trivial change would solve the problem of numerous errors in Visual Studio.
Furthermore, the namespace can be extended further. For example, you can add attributes to ignore warnings within a XAML subtree, specify context on bindings, specify type of data in properties other than DataContext. I suspect some of these features have been requested already.