Quantcast
Channel: YouTrackReSharper (RSRP) - Bug and Issue Tracker
Viewing all articles
Browse latest Browse all 106942

RSRP-256929: Cannot resolve symbol '....' due to unknown DataContext

$
0
0
Reporter Philip Lee (philip_lee) Philip Lee (philip_lee)
Created Apr 15, 2011 8:25:16 PM
Updated Mar 16, 2012 7:09:09 PM
Priority Critical
Type Bug
Fix versions 6.1
State Open
Assignee Alexander Shvedov (shvedov)
Subsystem Language - XAML
Affected versions 6.1
Fixed in build No Fixed in build
In this control template:

<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1">

<Style TargetType="{x:Type local:CustomControl1}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl1}">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<Grid>
<Grid.DataContext>
<local:CustomControl1ViewModel/>
</Grid.DataContext>
<Ellipse Fill="{Binding Fill}" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

{Binding Fill} is marked as unknown even though an instance of CustomControl1ViewModel is explicitly assigned to Grid.DataContext in the template.


namespace WpfApplication1
{
public class CustomControl1 : Control
{
static CustomControl1()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(CustomControl1), new FrameworkPropertyMetadata(typeof(CustomControl1)));
}
}

public class CustomControl1ViewModel
{
public CustomControl1ViewModel()
{
Fill = Brushes.CornflowerBlue;
}

public SolidColorBrush Fill { get; private set; }
}
}

Viewing all articles
Browse latest Browse all 106942

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>