"NOT_RESOLVED" error in XAML
I'm getting a NOT_RESOLVED error in the ReSharper XAML inspection. The XAML works fine at design time and runtime. Attached is the XAML.
The NOT_RESOLVED error is on the MethodName="GetProperties" element on line 15. Any ideas? Is there a way to disable this error, or disable XAML inspection for a single file?
<UserControl x:Class="My.ColorPicker"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:sys="clr-namespace:System;assembly=mscorlib" Height="25" Width="180" Name="uccolorpicker"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ObjectDataProvider MethodName="GetType" ObjectType="{x:Type sys:Type}" x:Key="ColorsTypeOdp">
<ObjectDataProvider.MethodParameters>
<sys:String>System.Windows.Media.Colors, PresentationCore,Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</sys:String>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ObjectDataProvider ObjectInstance="{StaticResource ColorsTypeOdp}" MethodName="GetProperties" x:Key="ColorPropertiesOdp" />
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<ComboBox ItemsSource="{Binding Source={StaticResource ColorPropertiesOdp}}" SelectedValuePath="Name" SelectedValue="{Binding ElementName=uccolorpicker, Path=SelectedColor}">
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" >
<TextBlock Width="15" Height="18" Margin="2" Background="{Binding Name}" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Name}" Margin="5,2,0,2" Style="{StaticResource InputNameStyle}" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</UserControl>
Source code follows:
using System.Windows.Controls;
using System.Windows.Media;
namespace My
{
/// <summary>
/// Interaction logic for <see cref="ColorPicker"/>.xaml
/// </summary>
/// <remarks>
/// Thanks to Sudheer Muhammed http://www.codeproject.com/Articles/140521/Color-Picker-using-WPF-Combobox
/// </remarks>
public partial class ColorPicker : UserControl
{
public ColorPicker()
{
InitializeComponent();
}
public Brush SelectedColor
{
get { return (Brush)GetValue(SelectedColorProperty); }
set { SetValue(SelectedColorProperty, value); }
}
// Using a DependencyProperty as the backing store for SelectedColor. This enables animation, styling, binding, etc...
public static readonly DependencyProperty SelectedColorProperty =
DependencyProperty.Register("SelectedColor", typeof(Brush), typeof(ColorPicker), new UIPropertyMetadata(null));
}
}
Please sign in to leave a comment.
Hello Wade,
What Resharper version do you use? This XAML looks fine on my ReSharper 7.1.2 - could you please attach a small sample project/solution, which will demonstrate this issue? Maybe it is something about particular project settings here.
Thanks in advance!
There is a project on the CodeProject site. Search for "wpf colorpicker" and it should be the first one that pops up. Here's a shortcut to the download link.
http://www.codeproject.com/KB/WPF/wpfcolorpickercombo/Customcontrols.zip
Also, I installed the 7.1.2 Resharper update and the problem still appears.
I posted a sample in the topic.
Hi Wade,
Thanks for the link to the source code. I've confirmed this issue in ReSharper 7.1.2 and logged it here for further fixing: http://youtrack.jetbrains.com/issue/RSRP-339425
Thank you very much for the report.