38440

Prefix 'xcdg' does not map to a namespace

Question:

I recently started playing with DataGridControl from Extended WPF Toolkit

<Grid x:Name="LayoutRoot" DataContext="{Binding Source={StaticResource SampleDataSource}}"> <xcdg:DataGridControl ItemsSource="{Binding Orders}" SelectionMode="Single" > <xcdg:DataGridControl.View> <xcdg:TableflowView FixedColumnCount="1" UseDefaultHeadersFooters="True" ShowRowSelectorPane="False" VerticalGridLineBrush="Green" VerticalGridLineThickness="2" HorizontalGridLineBrush="Purple" HorizontalGridLineThickness="2"> <xcdg:TableflowView.Theme> <xcdg:ZuneNormalColorTheme/> </xcdg:TableflowView.Theme> </xcdg:TableflowView> </xcdg:DataGridControl.View> <xcdg:DataGridControl.Columns> <xcdg:Column FieldName="OrderID" IsMainColumn="True"/> <xcdg:Column FieldName="ExternalID" /> <xcdg:Column FieldName="CustomerName" /> <xcdg:Column FieldName="Date" /> <xcdg:Column FieldName="Address" /> <xcdg:Column FieldName="Items" Width="*" /> </xcdg:DataGridControl.Columns> </xcdg:DataGridControl> </Grid>

It's ok and everything works. Then I added style.

<Style TargetType="{x:Type xcdg:DataGridControl}"> <Setter Property="Background" Value="MediumOrchid"/> </Style>

Style is applied and everything works again. So what I did next was creating CotrolTemplate using Expression Blend and added that template to my Style.

<Style TargetType="{x:Type xcdg:DataGridControl}"> <Setter Property="Background" Value="MediumOrchid" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type xcdg:DataGridControl}"> <Grid> <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <AdornerDecorator x:Name="PART_DragDropAdornerDecorator"> <xcdg:TableViewScrollViewer x:Name="PART_ScrollViewer" Padding="{TemplateBinding Padding}" RowSelectorPaneWidth="{Binding (xcdg:DataGridControl.DataGridContext).RowSelectorPaneWidth, RelativeSource={RelativeSource Self}}" ShowRowSelectorPane="{Binding (xcdg:DataGridControl.DataGridContext).ShowRowSelectorPane, RelativeSource={RelativeSource Self}}"> <xcdg:TableflowViewItemsHost /> </xcdg:TableViewScrollViewer> </AdornerDecorator> </Border> <Grid x:Name="connectionStateGrid" HorizontalAlignment="Right" Height="30" Margin="0,0,25,25" VerticalAlignment="Bottom" Width="30"> <ContentPresenter x:Name="connectionStateLoadingContentPresenter" ContentTemplate="{Binding (xcdg:DataGridControl.DataGridContext).ConnectionStateLoadingGlyph, RelativeSource={RelativeSource Self}}" Content="{TemplateBinding ConnectionState}" Visibility="Collapsed" /> <ContentPresenter x:Name="connectionStateCommittingContentPresenter" ContentTemplate="{Binding (xcdg:DataGridControl.DataGridContext).ConnectionStateCommittingGlyph, RelativeSource={RelativeSource Self}}" Content="{TemplateBinding ConnectionState}" Visibility="Collapsed" /> <ContentPresenter x:Name="connectionStateErrorContentPresenter" ContentTemplate="{Binding (xcdg:DataGridControl.DataGridContext).ConnectionStateErrorGlyph, RelativeSource={RelativeSource Self}}" Content="{TemplateBinding ConnectionState}" Visibility="Collapsed" /> </Grid> </Grid> <ControlTemplate.Triggers> <DataTrigger Binding="{Binding (xcdg:DataGridControl.DataGridContext).IsConnectionStateGlyphEnabled, RelativeSource={RelativeSource Self}}" Value="False"> <Setter Property="Visibility" TargetName="connectionStateGrid" Value="Collapsed" /> </DataTrigger> <DataTrigger Binding="{Binding (xcdg:DataGridControl.DataGridContext).DataGridControl.ConnectionState, RelativeSource={RelativeSource Self}}" Value="Loading"> <Setter Property="Visibility" TargetName="connectionStateLoadingContentPresenter" Value="Visible" /> <Setter Property="Visibility" TargetName="connectionStateErrorContentPresenter" Value="Collapsed" /> <Setter Property="Visibility" TargetName="connectionStateCommittingContentPresenter" Value="Collapsed" /> </DataTrigger> <DataTrigger Binding="{Binding (xcdg:DataGridControl.DataGridContext).DataGridControl.ConnectionState, RelativeSource={RelativeSource Self}}" Value="Committing"> <Setter Property="Visibility" TargetName="connectionStateLoadingContentPresenter" Value="Collapsed" /> <Setter Property="Visibility" TargetName="connectionStateErrorContentPresenter" Value="Collapsed" /> <Setter Property="Visibility" TargetName="connectionStateCommittingContentPresenter" Value="Visible" /> </DataTrigger> <DataTrigger Binding="{Binding (xcdg:DataGridControl.DataGridContext).DataGridControl.ConnectionState, RelativeSource={RelativeSource Self}}" Value="Error"> <Setter Property="Visibility" TargetName="connectionStateLoadingContentPresenter" Value="Collapsed" /> <Setter Property="Visibility" TargetName="connectionStateErrorContentPresenter" Value="Visible" /> <Setter Property="Visibility" TargetName="connectionStateCommittingContentPresenter" Value="Collapsed" /> </DataTrigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style>

But now whole ControlTemplate is underlined and it says

<blockquote>

<strong>Prefix 'xcdg' does not map to a namespace.</strong>

</blockquote>

there is

xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"

both in my resource dictionary and window. Also xaml designer throws exception in 'MainWindow.xaml' where 'DataGridControl' is placed. It's

<blockquote>

<strong>ArgumentException: '{DependencyProperty.UnsetValue}' is not a valid value for the 'System.Windows.Controls.Control.Template' property on a Setter.</strong>

</blockquote>

At runtime it works fine. All happened after I added ControlTemplate to Style of DataGridControl. Any explanation why is this happening or how to avoid this will be highly appreciated.

Answer1:

Seems like this issue still exists in VS2017. the exception is raised when using binding to dependency properties with namespace.

the solution I found is to explicitly add <strong>Path=</strong> to the binding.

Original code:

<pre class="lang-xaml prettyprint-override"><DataTrigger Binding="{Binding (xcdg:DataGridControl.DataGridContext).IsConnectionStateGlyphEnabled, RelativeSource={RelativeSource Self}}" Value="False">

Modified code:

<DataTrigger Binding="{Binding Path=(xcdg:DataGridControl.DataGridContext).IsConnectionStateGlyphEnabled, RelativeSource={RelativeSource Self}}" Value="False">

I've found the solution in <a href="http://sharepointbrainpump.blogspot.co.il/2012/12/solved-prefix-does-not-map-to-a-namespace-when-binding-to-a-custom-dependency-property.html" rel="nofollow">Heinrich Ulbricht Blog</a>

Answer2:

Well it was just problem with VS2012 Xaml Designer and it was <a href="http://connect.microsoft.com/VisualStudio/feedback/details/779344" rel="nofollow">reported</a> and fixed with VS Update 3.

Recommend

  • Blending languages - Python and Objective-C
  • How to bottom align text in WPF RichTextBox
  • How to set a Gtk2::Button's text colour?
  • Using an enum contained in a Cloud Endpoint model on a Android client
  • What's wrong with my datatrigger binding?
  • Android Lock Screen C# .NET Replica
  • Getting media player state in windows phone 7
  • Lock Horizontal View
  • Is there a way to save the selected text and highlight it again once the page is refreshed?
  • NUnit 3.0 TestCase const custom object arguments
  • Plotting line graph with factors in R
  • Debugging VB6 Code From Visual Studio 2010
  • Build Successful but not running on simulator
  • Button text different than value submitted in query string
  • How can I speed up CURL tasks?
  • Get history of file changes from TFS to implement custom “blame”-behaviour of exceptions
  • Do I need to reset a Perl hash index?
  • iOS: Detect app start via notification press
  • Can you perform a UNION without a subquery in SQLAlchemy?
  • Database structure design with variable amounts of fields
  • Google Custom Search with transparent background
  • Meteor helpers not available in Angular template
  • Android fill_parent issue
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • FFmpeg Conversion Error
  • How to access EntityManager inside Entity class in EJB3
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • How do I fake an specific browser client when using Java's Net library?
  • How to get a value (ex: baseURL) in every Karate feature?
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do I configure my settings file to work with unit tests?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Checking variable from a different class in C#
  • Binding checkboxes to object values in AngularJs