Hide/Show Contextual Tab?

Aug 3, 2010 at 10:28 PM
Hi, What is the best way to: -Show and activate a contextual tab on ribbonbutton click? -Make the contextual tab hide when a different button from a specific group is selected? Thanks!
Aug 5, 2010 at 11:58 AM
nobody? there must be an easy way to do this..
Coordinator
Aug 5, 2010 at 1:23 PM
Add avent handlers and put there myContextualTabGroup.Visibility = Visiblity.Collapsed; (?)
Aug 5, 2010 at 7:36 PM

Thanks, but what are the event handlers for selecting a specific group or groups?

Aug 6, 2010 at 5:08 AM
INotifyPropertyChanged



Aug 6, 2010 at 11:15 PM

I can't find that property Valdayka. Can you show me a quick code snippet?

Aug 14, 2010 at 1:33 PM

Can anyone help? I really can't find an answer to this!

Aug 16, 2010 at 11:47 AM
Surely you know the answer to this daVinci, please respond! :)
Coordinator
Aug 16, 2010 at 1:19 PM

What is "selecting a specific group or groups"? 

Coordinator
Aug 16, 2010 at 1:20 PM

If you mean contextual tab groups, maybe you will find useful Ribbon.SelectedTabChanged event.

Aug 17, 2010 at 7:39 AM

Basically I just want the contextual tab to act exactly as in, say, the 'drawing' contextual tab in office 2010. How can I achieve that?

Aug 19, 2010 at 11:39 AM
daVinci? Why don't you respond to threads for your own product without repeated requests...?
Coordinator
Aug 19, 2010 at 2:36 PM
Because I have nothing to add. Whenether you need to show a contextual tab group you must myContextualTabGroup.Visibility = Visiblity.Visible; to hide myContextualTabGroup.Visibility = Visiblity.Collapsed;
Aug 20, 2010 at 8:10 AM

That does not answer the question at all.

 

To repeat AGAIN, how can I make it disappear as in the 'Drawing' or any other contextual tab in Word 2010? Obviously I can make it disappear manually with myContextualTabGroup.Visibility = Visiblity.Collapsed, but how do I set it so that it will close automatically when a tool not in that tab is selected, or whatever else triggers it to close in Word 2010?

Aug 22, 2010 at 8:13 PM

really daVinci?

Coordinator
Aug 23, 2010 at 5:15 AM

Yep, what you asking is application specific code. You have to make it disappear based on your selection method. For exaple, we use MVVM in our applications and we need to subscribe to SelectedObjectChanged (or ViewModel.SelectedObjects.CollectionChanged event) to manipulate with contextual tab groups.

Daniel

Sep 1, 2010 at 7:50 PM

The code will be application specific in terms of the names of the tabs, but otherwise you should be able to explain? :)

The code to set any contextual tab to visibility.collapsed when a tool not in that tab is selected should be generic. But what is it? I honestly can't figure out how - and I've been trying for weeks! Surely there is basic code which you can show me which basically does as follows:

'If a contextual tab is open, and if any button in a tab other than that contextual tab is clicked, then close that contextual tab'

 

It seems so simple but I can't figure it out!

Thanks daVinci :)

 

Sep 2, 2010 at 2:47 PM

Normally, you would want to do the following:

 

<Fluent:RibbonTabItem x:Name="myTabItem" ... />

<Button x:Name="myButton" Click="myButton_Click" />

void myButton_Click(...) { myTabItem.Visibility = Visibility.Collapsed; }

 

However, if I understand you, there isn't a SINGLE button that the user might click on that is outside of myTabItem or even a couple. You want the above 'click' activity to occure for ALL BUTTONS that are outside of myTabItem?

If I understand this to be the case, then add a PreviewMouseClick on the highest control (in the VisualTree heiarchy) necessary to capture the PreviewMouseClick event and perform the 'click' activity there.

Sep 5, 2010 at 1:38 AM

Thanks, but as you said there isn't a single button the user might click. The last sentence is basically what I have been struggling to figure out for the past few weeks - I have no idea how to do it. I would hugely appreciate the code.. :)

Sep 11, 2010 at 9:58 AM

nobody? I can't believe this obvious action can not be done with a short piece of code!

Sep 13, 2010 at 7:49 PM

daVinci, your ribbon control is largely useless if you do not explain how to make major features function as they should. This might be partly application specific code, but only for actual names. I just need this basic concept to function:

'If a contextual tab is open, and if any button in a tab other than that contextual tab is clicked, then close that contextual tab'

 

It is clearly not application specific, and I've (as you can tell by when I started this thread) have been trying to get this to work for almost a month and a half - please just respond with an answer..

Coordinator
Sep 14, 2010 at 4:18 AM

This control is just another WPF control. What you are asking is 100% application specific code. Normally, you do not need such things to do. You should read something about MVVM. In your current code you can try something like this (I haven't checked it):

...
<Fluent:RibbonContextualTabGroup x:Name="myContextualTabGroup"....
...
<Fluent:RibbonTabItem ... PreviewMouseDown="OnATabMouseDown"....
<Fluent:RibbonTabItem ... PreviewMouseDown="OnATabMouseDown"....
....
....

In code:

void OnATabMouseDown(object sender, ....)
{
     myContextualTabGroup.Visibility=Visibility.Collapsed;
}