wpf - ContextMenu in Style setter -


Does anyone know why this would create an XamlParseException? "System.Windows.Controls.ContextMenu" object type 'System.Object' ":

  & lt; ItemsControl & gt; & LT; ItemsControl.ItemsPanel & gt; & LT; ItemsPanelTemplate & gt ; & Lt; canvas Kliptobonds = "true" / & gt; & Lt; / ItemsPanelTemplate & gt; & LT; /ItemsControl.ItemsPanel> & LT; ItemsControl.ItemContainerStyle & gt; & Lt; style TargetType = "ContentPresenter" & gt ; & Lt; setter property = "context menu" & gt; & LT; Setter.Value & gt; & LT; ContextMenu & gt; & Lt; MenuItem header = "remove" / & gt; & Lt; / ContextMenu & gt ; & LT; /Setter.Value> & Lt; / setter & gt; & Lt; / style & gt; & LT; /ItemsControl.ItemContainerStyle> & Lt; / ItemsControl & gt;  
< P> And the following work just fine?

  & lt; itemsControl & gt; & lt; ItemsControl.Resou rces & gt; & Lt; ContextMenu x: Key = "NodeContextMenu" & gt; & Lt; MenuItem Header = "remove" / & gt; & Lt; / ContextMenu & gt; & LT; /ItemsControl.Resources> & LT; ItemsControl.ItemsPanel & gt; ItemsPanelTemplate & gt; & Lt; Canvas Clipboards = "True" /> & Lt; / ItemsPanelTemplate & gt; & Lt; /ItemsControl.ItemsPanel> & Lt; ItemsControl.ItemContainerStyle & gt; & Lt; Style TargetType = "ContentPresenter" & gt; & Lt; Setter property = "context menu" value = "{static resource node configuration menu}" /> & Lt; / Style & gt; & Lt; /ItemsControl.ItemContainerStyle> & Lt; / ItemsControl>  

looks like a bug which was later fixed - code in question An XAMM creates an exception to the exception when targeting .NET 3.5, but works fine for me when targeting .NET 4.0. If you follow the link given in the above comments, you will get a connected issue with the comments of other people who inform you that the problem has ended. NET 4.0.


Comments