c# - Caliburn Micro design time using naming conventions -


using caliburn micro 1.5.1 i'm trying design time bindings work in wp8 app. have created design time viewmodel specify explicitly in phoneapplicationpage:

<phone:phoneapplicationpage     d:datacontext="{binding source={d:designinstance type=designtime:startpagedesigntimeviewmodel, isdesigntimecreatable=true}}"     micro:bind.atdesigntime="true" 

the page no more raddataboundlistbox telerik:

<grid x:name="contentpanel">     <telerikprimitives:raddataboundlistbox x:name="rooms"  ...> 

as can see, viewmodel (and design time view model) have public property named rooms binding itemssource collection using named convention approach. approach doesn't work @ design time, however, unless add itemssource property

<grid x:name="contentpanel">     <telerikprimitives:raddataboundlistbox x:name="rooms" itemssource="{binding rooms}" ...> 

however, when use itemssource binding lose cm wire-up magic selecteditem. there way bindings work @ design time using naming conventions approach without modifying page other design time attributes?

ok, figured out. looking ability overwrite existing bindings @ times. cm more defensive that, , default won't replace existing bindings or values itemscontrol. behavior defined in conventionmanager.cs thusly:

addelementconvention<itemscontrol>(itemscontrol.itemssourceproperty, "datacontext", "loaded") .applybinding = (viewmodeltype, path, property, element, convention) => {     if (!setbindingwithoutbindingorvalueoverwrite(viewmodeltype, path, property, element, convention, itemscontrol.itemssourceproperty)) {         return false;     }      applyitemtemplate((itemscontrol)element, property);      return true; }; 

what did force framework replace binding replace call setbindingwithoutbindingorvalueoverwrite direct call setbinding in bootstrapper. so:

conventionmanager.addelementconvention<itemscontrol>(itemscontrol.itemssourceproperty, "datacontext", "loaded")              .applybinding = (viewmodeltype, path, property, element, convention) => {                                  conventionmanager.setbinding(viewmodeltype, path, property, element, convention, itemscontrol.itemssourceproperty);                                   conventionmanager.applyitemtemplate((itemscontrol) element, property);                                  return true;                              }; 

(i had make edit convention had added earlier raddataboundlistbox)

i can see might want declaratively force replace existing binding in cases. maybe i'll write patch...


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -