Access a Button in a ContentView file

jrahma 111 Reputation points
2021-07-02T18:52:28.517+00:00

Hi,

I have MainPage ContentPage

Then I have Signin ContentView

From MainPage I am Opening a Popup placed inside Signin.

My MainPage looks like this:

popupLayout = new SfPopupLayout();

contentTemplateView = new DataTemplate(() =>
{
    return new SigninEmail(this.popupLayout);
});

popupLayout.ShowOverlayAlways = true;
popupLayout.PopupView.PopupStyle.CornerRadius = 25;
popupLayout.PopupView.AutoSizeMode = AutoSizeMode.Both;
popupLayout.PopupView.ShowFooter = false;
popupLayout.PopupView.ShowHeader = true;
popupLayout.PopupView.HeaderTitle = "Sign in";
popupLayout.PopupView.ContentTemplate = contentTemplateView;
popupLayout.PopupView.AnimationMode = AnimationMode.SlideOnBottom;
popupLayout.PopupView.ShowCloseButton = false;
popupLayout.PopupView.IsFullScreen = false;

popupLayout.Closed += PopupLayout_Closed;

popupLayout.Show();

My Signin is this:

<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:SyncfusionInputLayout="clr-namespace:Syncfusion.XForms.TextInputLayout;assembly=Syncfusion.Core.XForms"
    xmlns:SyncfusionBusyIndicator="clr-namespace:Syncfusion.SfBusyIndicator.XForms;assembly=Syncfusion.SfBusyIndicator.XForms"
    xmlns:SyncfusionButtons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
    x:Class="Zeera.SigninEmail">
    <Grid BackgroundColor="{AppThemeBinding Light='#ffffff', Dark='#404040'}" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" Padding="15">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <SyncfusionInputLayout:SfTextInputLayout Grid.Row="0" HeightRequest="60" Hint="Email Address" ContainerType="Outlined">
            <Entry x:Name="TextBoxSigninEmailAddress" IsTextPredictionEnabled="False" Keyboard="Email" HorizontalTextAlignment="Center" />
        </SyncfusionInputLayout:SfTextInputLayout>

        <SyncfusionBusyIndicator:SfBusyIndicator x:Name="BusyIndicatorSignin" Grid.Row="1" Margin="5" HorizontalOptions="Center" VerticalOptions="Center" IsBusy="False" AnimationType="SingleCircle" HeightRequest="30" WidthRequest="30" ViewBoxWidth="40" ViewBoxHeight="40" />
        <SyncfusionButtons:SfButton x:Name="ButtonSigninNow" Grid.Row="1" Text="Continue" Margin="0,5,0,5" CornerRadius="10" BackgroundColor="Navy" TextColor="White" FontAttributes="Bold" HeightRequest="60" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" BorderWidth="1" BorderColor="LightGray" Clicked="ButtonSigninNow_Clicked" />
    </Grid>
</ContentView>

In the popupLayout.Closed += PopupLayout_Closed located above (inside the MainPage) I want for example to set the IsVisible of ButtonSigninNow to True

How can I do that please?

Thanks,
Jassim

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,315 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,521 questions
0 comments No comments
{count} votes