Determine if a ribbon tab is selected

Ribbon for WPF Forum

Posted 10 years ago by Mark Foti
Version: 13.2.0592
Avatar

Hi,

I need to know if a tab is opened. So I tried using the following code with different variations of the binding mode.

 

<ribbon:Ribbon>
<ribbon:Tab Label="Home">
</ribbon:Tab>
<ribbon:Tab Label="Try selected" IsSelected="{Binding Path=IsSelectedProperty}">
</ribbon:Tab>
</ribbon:Ribbon>

 

        private bool isSelectedProp;
        public bool IsSelectedProperty
        {
            get { return isSelectedProp; }
            set { 
                isSelectedProp = true;
                OnPropertyChanged("IsSelectedProperty");
            }
        }

 
The problem is that when Mode is one of {Default, OneTime, OneWay, TwoWay} either the properties get function or using OneWayToSource the properties set function is called only once at the beginning. Also the tabs visual selection indication stops working.

So none of the combinations is reading and writing to the property and none is updating the status. How can I reliably determine and set the value of the tabs selection?

 

Kind regards

[Modified 10 years ago]

Comments (4)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mark,

I would recommend that you bind ot the Ribbon.SelectedTab property instead.  That will always tell you which tab is currently selected.


Actipro Software Support

Posted 10 years ago by Mark Foti
Avatar

Hi,

I added the binding

<ribbon:Ribbon
x:Name ="ribbon"
SelectedTabChanged="dockPanel_SelectedTabChanged"
SelectedTab="{Binding MySelectedTab}"
>

I neither get a message about a failed binding nor do I hit my breakpoints in the property. What may I be missing?

Kind regards

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Mark,

SelectedTab is a dependency property so it should be working with bindings ok.  If you are still having trouble, please make a new very simple sample project that shows it not working and email that to our support address.  Mention this thread in your email and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 10 years ago by Mark Foti
Avatar

Hi,

the problem is gone. I cannot, however, tell you the cause of the problem. Thank you for your help.

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.