Xamarin Forms - Find Control of MainPage from any Class or Page
Find Control of MainPage from any Class or Page
E.g. If you have Menu on MainPage and you need to apply Rights from User Validation Class.
How do you access Control / Button of Menu from the class
Code :
Button button = null;
button = (Button)App.Current.MainPage.FindByName("btnStkRpt_CustCsgSumm");
if (button != null)
{
button.IsEnabled = true;
button.IsVisible = true;
}
Note : This will find control on mainpage (Startup Page or Current Main Page)
Comments
Post a Comment