Here is an explanation from Adam Nathan WPF 4 unleashed book (I advise everyone to read):
The x: Reference markup extension is often mistakenly associated with XAML2009 functions that can only be used from free XAML at the time of this writing. Although x: Reference is a new feature in WPF 4, it can be used with XAML2006 just fine, as long as your project targets version 4 or later of the .NET Framework. One failure is that the XAML designer in Visual Studio 2010 does not correctly handle x: Reference, so it gives the following development-time error, which you can safely ignore: The service provider does not have the INameResolver service.
In any case, this message can be ignored. For my Visual Studio 2010 it sometimes appears, sometimes not.
EDIT:
I found another quote ( source ), but they do not offer specific solutions:
When using {x: Reference} as the target of the WPF shortcut, the Visual Studio designer throws an InvalidOperationException with the message "The service provider does not have the INameResolver service." The project will compile and run without any problems, but the Design canvas, which displays x: Reference, will be disabled due to an exception. At the time of this writing, this is a known issue and needs to be addressed in the future.
Here, the author specifically explains this problem and writes that he sent a bug report to Microsoft .
BooleanToVisibilityConverter
<Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> </Window.Resources>
DataGrid XAML
<DataGrid AutoGenerateColumns="False" Name="dataGrid1"> <DataGrid.ContextMenu> <ContextMenu> <MenuItem x:Name="showcol1" Header="Show Column 1" IsCheckable="True" IsChecked="True" /> <MenuItem x:Name="showcol2" Header="Show Column 2" IsCheckable="True" IsChecked="False" /> </ContextMenu> </DataGrid.ContextMenu> <DataGrid.Columns> <DataGridTextColumn Header="Col 0" /> <DataGridTextColumn Header="Col 1" Visibility="{Binding Source={x:Reference Name=showcol1}, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}" /> <DataGridTextColumn Header="Col 2" Visibility="{Binding Source={x:Reference Name=showcol2}, Path=IsChecked, Converter={StaticResource BooleanToVisibilityConverter}}" /> </DataGrid.Columns> </DataGrid>
Anatoliy Nikolaev
source share