c# - Custom ItemsControl Child Control Namespace Issue -


i'm having trouble adding controls x:name custom control.

adding x:name="startdate" causes break. otherwise works perfectly.

i have custom control inheriting itemscontrol.

using system; using system.windows; using system.windows.controls; using system.windows.documents; using system.windows.ink; using system.windows.input; using system.windows.media; using system.windows.media.animation; using system.windows.shapes;  namespace controlcsi {     public partial class slidemenu : itemscontrol     {         public slidemenu()         {             // required initialize variables             initializecomponent();         }     } } 

here markup definition of class

<itemscontrol xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:ignorable="d" x:class="controlcsi.slidemenu" d:designwidth="200" d:designheight="800">  <itemscontrol.itemspanel>     <itemspaneltemplate>         <stackpanel orientation="vertical" />     </itemspaneltemplate> </itemscontrol.itemspanel>  <itemscontrol.template>     <controltemplate targettype="itemscontrol">         <grid x:name="layoutroot">             <border height="auto" grid.column="0" cornerradius="5" >                 <grid>                     <grid.columndefinitions>                         <columndefinition width="23" />                         <columndefinition width="*" />                     </grid.columndefinitions>                     <border background="transparent">                         <image source="/controlcsi;component/images/glossyblack/bg_pulltab.png"  />                     </border>                     <grid grid.column="1" >                         <border cornerradius="10,0,0,10" borderbrush="#11c2f1" borderthickness="0">                             <border.background>                                 <imagebrush  imagesource="/controlcsi;component/images/glossyblack/bg_nav.png"/>                             </border.background>                             <itemspresenter />                         </border>                     </grid>                 </grid>             </border>         </grid>     </controltemplate> </itemscontrol.template>     

and here implementation:

<controlcsi:slidemenu x:name="slideoutmenu" width="200" verticalalignment="stretch"  horizontalalignment="right" rendertransformorigin="0.5,0.5" >             <controlcsi:slidemenu.rendertransform>                 <compositetransform translatex="180"/>             </controlcsi:slidemenu.rendertransform>              <telerik:radbutton margin="5,10,5,0"  click="radbutton_click" tag="30" content="30 days" style="{staticresource sliderbutton}"  />             <telerik:radbutton  click="radbutton_click" tag="60" content="60 days" style="{staticresource sliderbutton}"/>             <telerik:radbutton  click="radbutton_click" tag="90" content="3 months" style="{staticresource sliderbutton}"/>             <telerik:radbutton  click="radbutton_click" tag="180" content="6 months" style="{staticresource sliderbutton}"/>             <telerik:raddatepicker x:name="startdate" x:uid="startdate"  dropdownopened="startdate_dropdownopened" dropdownclosed="startdate_dropdownclosed"    datetimewatermarkcontent="start date" style="{staticresource sliderdatepicker}"  template="{staticresource raddatetimepickercontroltemplate1}"  />             <telerik:raddatepicker  dropdownopened="startdate_dropdownopened" dropdownclosed="startdate_dropdownclosed"    datetimewatermarkcontent="end date" style="{staticresource sliderdatepicker}" template="{staticresource raddatetimepickercontroltemplate1}"  />           </controlcsi:slidemenu> 

errors:

  first chance exception of type 'system.nullreferenceexception' occurred in controlcsi system.windows.data error: bindingexpression path error: 'errorresources' property not found on 'controlcsi.resourcewrapper' 'controlcsi.resourcewrapper' (hashcode=42863040). bindingexpression: path='errorresources.errorwindowtitle' dataitem='controlcsi.resourcewrapper' (hashcode=42863040); target element 'controlcsi.errorwindow' (name=''); target property 'title' (type 'system.object').. system.windows.data error: bindingexpression path error: 'errorresources' property not found on 'controlcsi.resourcewrapper' 'controlcsi.resourcewrapper' (hashcode=42863040). bindingexpression: path='errorresources.errorwindowgenericerror' dataitem='controlcsi.resourcewrapper' (hashcode=42863040); target element 'system.windows.controls.textblock' (name='introductorytext'); target property 'text' (type 'system.string').. system.windows.data error: bindingexpression path error: 'errorresources' property not found on 'controlcsi.resourcewrapper' 'controlcsi.resourcewrapper' (hashcode=42863040). bindingexpression: path='errorresources.errorwindowerrordetails' dataitem='controlcsi.resourcewrapper' (hashcode=42863040); target element 'system.windows.controls.textblock' (name='labeltext'); target property 'text' (type 'system.string').. 

x:name creates local variable guessing namespace issue ?

i dont think can add x:name control because provides name property. check out remarks section of [this msdn link].1

you can use name property in same way use x:name (i think).

best of luck

adding link cause i'm not sure used linking behavior right :p http://msdn.microsoft.com/en-us/library/cc189028%28v=vs.95%29.aspx


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -