c# - Readonly DependencyProperty does not exist in XML namespace -
my existing c#/wpf project not working after installing visual studio 2008. working fine in visual studio 2008.
i'm getting following error on xaml
the property 'designtimehelper.designtimedata' not exist in xml namespace 'clr-namespace:monitor.controls'. line 13 position 5.
please find attached xaml , cs file
<usercontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:crl="clr-namespace:monitor.controls" xmlns:dat="clr-namespace:system.windows.data;assembly=presentationframework" xmlns:ui="clr-namespace:uicontrols;assembly=uicontrols" crl:designtimehelper.designtimedata="{x:type svm:samplealertstabviewmodel}" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d"> ... </usercontrol>
using system; using system.collections.generic; using system.linq; using system.text; using system.componentmodel; using system.windows; namespace monitor.controls { public static class designtimehelper { public static readonly dependencyproperty designtimedataproperty = dependencyproperty.registerattached("designtimedata", typeof(type), typeof(designtimehelper), new frameworkpropertymetadata(null, new propertychangedcallback(ondesigntimedatachanged))); public static type getdesigntimedata(dependencyobject obj) { return (type)obj.getvalue(designtimedataproperty); } public static void setdesigntimedata(dependencyobject obj, type value) { obj.setvalue(designtimedataproperty, value); } private static void ondesigntimedatachanged(dependencyobject d, dependencypropertychangedeventargs e) { var isondesignmode = designerproperties.getisindesignmode(new dependencyobject()); if (isondesignmode) { var element = d frameworkelement; if (element == null) throw new nullreferenceexception("element must not null , must uielement."); var designtimedatatype = e.newvalue type; if (designtimedatatype == null) throw new nullreferenceexception("designtimedatatype must not null."); element.datacontext = activator.createinstance(designtimedatatype); } } } }
why dependencyproperty not working ? requires other dependency?
please share ideas.
thanks
Did you resolved?
ReplyDelete