This is a migrated thread and some comments may be shown as answers.

Visibility question

7 Answers 90 Views
RibbonView and RibbonWindow
This is a migrated thread and some comments may be shown as answers.
Oliver
Top achievements
Rank 1
Oliver asked on 23 May 2012, 02:53 PM

I have a RadRibbonView with his "IsMinimized" property set to "True". In my RadRibbonView, I have a "Search" RadRibbonTab with many fields and a search button. If my users click on the RadRibbonTab, the RadRibbonTab expand and the user can enter values the fields and click on the search button to start searching informations.

I'm trying to implement a CTRL+F gesture (search shortcut) and I would like to know how I can force the RadRibbonTab to be visible by code to simulate a user click on the RadRibbonTab.

Thank's

7 Answers, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 25 May 2012, 11:04 AM
Hello Oliver,

You can use the following code in your handler for the CTRL+F gesture:
var popup = ribbon.ChildrenOfType<Popup>().LastOrDefault();
if (popup != null)
{
   popup.IsOpen = true;
}
If you need further help feel free to ask.

All the best,
Viktor Tsvetkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oliver
Top achievements
Rank 1
answered on 25 May 2012, 03:29 PM
Hi Viktor,

as I'm on DotNet 3.5 I had to modify your code a little bit because of the LastOrdDefault function but I still having a problem. I have to expand and collapse at least one time manually my RadRibbonTab to have my gesture working correctly. If I not doing this, the RadRibbionTab never show up. If I put a breakpoint in my code, in both situation, my application stop ont it.

Thank's

  private void gestureSearch_Trigger(object sender, ExecutedRoutedEventArgs e)
  {   
   IEnumerable<Popup> allPopups = radRibbonBar.ChildrenOfType<Popup>();

   if (allPopups != null)
   {
    Popup thePopup = null;

    foreach(Popup onePopup in allPopups)
    {
     thePopup = onePopup;
    }

    if (thePopup != null)
    {
     thePopup.IsOpen = true;
     ribtabSearch.Focus();
     wtbSearchNCE.Focus();
    }
   }
  }

0
Tina Stancheva
Telerik team
answered on 29 May 2012, 03:27 PM
Hello Oliver,

I attached a sample solution demonstrating how to get over this issue. Basically it's best to select the search tab instead of focusing it. Also, you'll need to focus the input control a bit later in order to make sure it will be property focused, so you'll have to use a dispatcher.

Please have a look at the project and let me know if it helps.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oliver
Top achievements
Rank 1
answered on 29 May 2012, 03:44 PM
Hi,

this code should work on .Net 3.5???

Thank's
0
Tina Stancheva
Telerik team
answered on 29 May 2012, 05:53 PM
Hello Oliver,

The application I sent over is targeting WPF 3.5. Doesn't it work on your side? Please let me know if I'm missing something.

Regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Oliver
Top achievements
Rank 1
answered on 29 May 2012, 07:02 PM
Hi,

LastOrDefault method was not recognized!!!

Thank's
0
Tina Stancheva
Telerik team
answered on 31 May 2012, 03:41 PM
Hello Oliver,

I'm sorry, I should've used your approach instead. I modified my sample to not use the LastOrDefault method. Please let me know if the sample works for you now.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
RibbonView and RibbonWindow
Asked by
Oliver
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Oliver
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or