Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The attribute "ConnectionId" does not exist in "http://schemas.microsoft.com/winfx/2006/xaml"

Tags:

c#

wpf

xaml

I'm working on a project I had to build from decompiled code through ILSpy. When I try to compile the XAML code, I get this error:

The attribute 'ConnectionId' from the XAML namespace is not defined.

The header section of the XAML is defined as follows:

<UserControl x:Class="..." Name="..." Loaded="..." SizeChanged="..." 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vtbc="clr-namespace:..."
    xmlns:p="clr-namespace:..."
    xmlns:local="clr-namespace:...">  

While the class behind the XAML is defined as follows:

public partial class ... : UserControl

The exception is thrown by lines such as the following:

<Style x:Key="{x:Type DataGridCell}" TargetType="{x:Type DataGridCell}" x:ConnectionId="16" />

From what I have read, what this does is that it attaches numbers to components so that it can later, attach the respective event handlers.

Anyone can provide hints/ideas where I can look or what I can do to fix this problem?

The other half of the partial class:

public partial class ... : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {

I am noticing that it is missing the IStyleConnector (the ILSpy counter part has it).

EDIT: Forgot to mention what is the project referencing:

  • Microsoft.CSharp
  • PresentationCore
  • PresentiationFramework
  • System
  • System.Core
  • System.Data
  • System.Datat.DataSetExtensions
  • System.Xaml
  • System.Xml
  • System.Xml.Linq
  • WindowsBase
like image 609
npinti Avatar asked Nov 19 '25 13:11

npinti


1 Answers

The Property ConnectionId is located in the XAML namespace as the reference explains: https://msdn.microsoft.com/de-de/library/system.xaml.xamllanguage.connectionid(v=vs.110).aspx

The definitions in the root of your xaml file:

xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

are referring two the wpf-xaml namespace(no prefix) and the xaml language(with prefix).

I never used ConnectionId, but I was expecting it to reside in the XAML namepspace as the msdn explained it. However this is not the case, which is why you are gettign this error since the property is not defined in http://schemas.microsoft.com/winfx/2006/xaml.

But in the http://schemas.microsoft.com/winfx/2006/xaml/presentation namespace.

like image 63
Xeun Avatar answered Nov 22 '25 03:11

Xeun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!