Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
165
ApplicationMenu - DataContext Binding not correct or not possible ???
posted

Hello,

I have a strange issue with the datacontext-binding to the application-menu, which I do not have when binding to the ribbon-tabs

I have my Viewmodel which exposes iCommands.

First, whta is working correctly:

When I bind to a ribbonTabItem, the following works OK

 

 

 

 

 

 

 

 

 

 

 

 

 

<

 

igRibbon:RibbonTabItem x:Name="xamRibbon1_Tab_Main" Header="Main" DataContext="{Binding Path=Ribbon_ApplicationMenu_ViewModel}">

 

 

 

<igRibbon:RibbonGroup Id="ribgrp_Main_MainData" Caption="Main Data">

 

 

 

<igRibbon:ButtonTool Id="rib_Main_Data_ProjectNew" Caption="New Project" Command="{Binding Path=Project_New_Command}"</igRibbon:ButtonTool

 

 

</igRibbon:RibbonGroup>

 

 

 

 

 

</igRibbon:RibbonTabItem>

When I bind to the same to the applicationMenu --> my commands don't work when clicked on button

<igRibbon:XamRibbon.ApplicationMenu>

 

 

 

 

 

<igRibbon:ApplicationMenu DataContext="{Binding Path=Ribbon_ApplicationMenu_ViewModel}">

 

 

<igRibbon:ButtonTool Id="rib_App_Menu_ProjectNew" Caption="New Project" Command="{Binding Path=Project_New_Command}"</igRibbon:ButtonTool>

 

</

 

igRibbon:ApplicationMenu>

 

 

 

</igRibbon:XamRibbon.ApplicationMenu>

In my output-debug window I wrote system.out-lines when the "get of the Command" in my viewModel is executed.

Now the strange part: in both cases, the debug-line is printed out (so the correct command should be linked...)

But when clicking on it in the application-menu, nothing happens. but when clicking on it in the ribbontabitem, my command is executed.

I did the test also with simple databinding with a string to the caption --> both thimes the getter for the text is executed, but in the application-menu the caption is EMPTY !!!

Does anyone have an idea what could be wrong?

*) is setting the datacontext for applicationmenu working: I think yes, because the getters on my viemwodel are executed

But why do they not react to a click, why is the caption EMPTY in app-menu and not in ribbontab...

My goal is having different Viewmodels for the application-menu, eacht tabitem, ... instead of one big Viewmodel for the whole ribbon.

But if that's the solution, only 1 datacontext binding to the whole ribbon, then I can maybe change my idea.

thx

Fred

 

 

  • 9694
    posted

    I apologize no one has yet responded to this post.

    Have you tried a newer version of NetAdvantage to see if this problem still exists? If you still have this problem, please let us know. It sounds like a bug. In which case, developer support would be the best way for resolving the issue:

    http://ko.infragistics.com/gethelp

    Thank you,

  • 165
    Offline posted

    Hi again,

    When I test my application with only 1 datacontext-binding on the Ribbon, it is working.

    My commands in the application-menu and my commands in the tabs are correctly working.

    My next test was settings only the datacontext on the application-menu, and then it doesn't work anymore...

     

    I just notice something other.

    When the application-menu open the first time, I see that my getters are executed again. So they have been executed one time when they are not visible, and the first time they are shown.

    This is only when the binding is working correctly (so whith 1 datacontext set on the ribbon-root)

    In the case where i only set the datacontext on the application menu, my getter is executed NOT when i open the first time the application menu...

     

    So there has to be something special with the datacontext-setting of the application-menu. Setting this as the only datacontext, or setting it to a different datacontext of the ribbon-root, seems not working for me.

     

    But for now, I will remodel my viemmodels so that I have one gerenal ViemModel for the whole ribbon at once.

     

    Still, if anyone has some remarks on it. Please share them.

     

    thx

    Fred