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
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
;
}
All the best,
Viktor Tsvetkov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
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();
}
}
}
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 >>
this code should work on .Net 3.5???
Thank's
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 >>
LastOrDefault method was not recognized!!!
Thank's
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 >>