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
714
Binding RibbonTabItem doesn't render correctly
posted

Hi,

I try to render ContextualTabs through data binding by binding the Content property of a RibbonTabItem and defining a DataTemplate for those property types. Binding works but the RibbonTabItem is not rendered correctly.

I've attached the sample project and screen output. In the project I've created two RibbonTabItems in ContextualTabGroups. First one is not binded but the second one is. Both of them has the same content but as you will see the first one renders correctly but the second one does not.

Can you check out the sample and help me to fix the problem?

It's really urgent and I don't want to wait a week to get an answer as my other posts!

Thanks in advance

RibbonBinding.zip
Parents
  • 69686
    Verified Answer
    posted

    Hello,

    I apologize that your post was not answered sooner.

    To the best of my knowledge, this is not the recommended way of achieving this. The XamRibbon uses complex resize logic to adhere to the behavior described in the Microsoft Office Ribbon Guidelines. I think that binding directly the content of a RibbonTabItem is not possible. The data template you are using contains a ribbon group which will be placed as a direct content of the RibbonTabItem and will not allow the XamRibbon to manage its internal resizing logic. What you could do is to bind the content of the RibbonGroup to a similar template (just take out the RibbonGroup out of the data template and leave the Grid as root element).

               <igRibbon:RibbonTabItem Header="{Binding ContextualTab_01.TabItemHeader}">

                    <igRibbon:RibbonGroup Caption="{Binding ContextualTab_01.TabItemHeader}">

                        <ContentPresenter Content="{Binding ContextualTab_01}"/>

                    </igRibbon:RibbonGroup>

                  </igRibbon:RibbonTabItem>

     

     <DataTemplate  DataType="{x:Type vwm:CustomContextualTab_01}">

                <Grid>

                  ...

                </Grid>

    </DataTemplate>

Reply Children
No Data