c# - How to use ElementName binding from resource? -
i've added menuflyout button in itemscontrol.itemtemplate. able bind current item commandparameter. want bind command menuflyoutitem. in codebehind :
layoutroot.datacontext = this;
so if bind layoutroot bind current usercontrol. following binding not working:
command="{binding activateprofilecommand, elementname=layoutroot}"
it gives me not errors in output it's not working. here's full example:
<controls:headerdecorator x:uid="accountsheader" text="accounts" x:name="layoutroot" name="layoutroot"> <controls:headerdecorator.resources> <menuflyout x:key="accountmenuflyout"> <menuflyoutitem text="activate" name="activate" command="{binding activateprofilecommand, elementname=layoutroot}" commandparameter="{binding}" /> </menuflyout> </controls:headerdecorator.resources> <stackpanel orientation="vertical"> <itemscontrol itemssource="{binding settings.profiles}" > <itemscontrol.itemtemplate> <datatemplate> <hyperlinkbutton content="{binding}" flyoutbase.attachedflyout="{staticresource accountmenuflyout}" > <i:interaction.behaviors> <ic:showflyoutbehavior /> </i:interaction.behaviors> </hyperlinkbutton> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </stackpanel> </controls:headerdecorator>
seems problem i'm trying use shared object in resources. can it? , why not?
Comments
Post a Comment