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

Is there a global FindStrategy?

2 Answers 50 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dren
Top achievements
Rank 1
Dren asked on 02 Feb 2012, 07:13 AM
I would like to set the FindStrategy globally so that whenever I do a Find on any of its children, I don't have to set the Strategy on this child to WhenNotVisibleReturnNull.

Even though I set the strategy to this on the application itself, if I'm calling Find on a control within the application, it reverts back to the default which I believe is WhenNotVisibleThrowException.

Which brings me to my next question: Why, oh why is that the default? Not knowing there was a FindStrategy caused me hours of painful googling. According to the documentation, the Find methods return null when the element doesn't exist. So WhenNotVisibleReturnNull I believe should be the default.

Many Thanks!

2 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 07 Feb 2012, 01:02 AM
Hello Dren,

The closest thing we have to the global find strategy today is this:

Manager.Elements.ReturnElementProxyWhenNotFound = true;

I have filed a feature request with regard to the default behavior of the find strategy on elements found in the app here. Please review it and let me know if I've captured the essence of your request.

Kind regards,
Cody
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Dren
Top achievements
Rank 1
answered on 09 Feb 2012, 01:18 AM
Thanks Cody for logging this feature request.

I tried the ReturnElementProxyWhenNotFound as you described below, but it didn't work - still threw an exception when it couldn't find the element.

I'll stick to the original Find Strategy code and will just have to declare this for every control...

Thanks!
Tags
General Discussions
Asked by
Dren
Top achievements
Rank 1
Answers by
Cody
Telerik team
Dren
Top achievements
Rank 1
Share this question
or