Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
146828 | Aug 22,2019 04:25 AM UTC | Sep 2,2019 04:53 AM UTC | Xamarin.Forms | 7 |
![]() |
Tags: SfTextInputLayout |
Greetings
from Syncfusion.
We have
achieved your requirement using the SfPopUpLayout, please refer the below code
snippet for your reference. We have attached the sample, please download it
from the below location.
Code
Snippet:
Xaml:
<Grid Margin="10,50,10,10"> |
C#:
private void GestureRecognizer_Tapped(object sender, System.EventArgs e) } public class ViewModel : INotifyPropertyChanged |
Please
let us know if your need further assistance on this.
Regards,
Lakshmi
R.
<StackLayout Margin="10,50,10,10">
<inputLayout:SfTextInputLayout
x:Name="birthdayLayout"
ContainerType="Outlined"
HelperText="Tap the input field to enter text">
<StackLayout>
<Entry TextColor="Black" IsReadOnly="True" InputTransparent="True" x:Name="layoutEntry" Text="{Binding Text, Mode=TwoWay}" />
<StackLayout.GestureRecognizers>
<TapGestureRecognizer x:Name="entryGesture"
Tapped="GestureRecognizer_Tapped" />
</StackLayout.GestureRecognizers>
</StackLayout>
</inputLayout:SfTextInputLayout>
<sfPopup:SfPopupLayout IsVisible="false" x:Name="popupLayout">
<sfPopup:SfPopupLayout.PopupView>
<sfPopup:PopupView HeightRequest="230"
HeaderTitle="Enter the text"
ShowFooter="False">
<sfPopup:PopupView.ContentTemplate>
<DataTemplate>
<StackLayout x:Name="mainLayout">
<Entry Focused="PopUpEntry_Focused" Text="{Binding Text, Mode=TwoWay}" IsEnabled="True" x:Name="popUpEntry"/>
</StackLayout>
</DataTemplate>
</sfPopup:PopupView.ContentTemplate>
</sfPopup:PopupView>
</sfPopup:SfPopupLayout.PopupView>
</sfPopup:SfPopupLayout>
</StackLayout>
|
public partial class Sample : ContentPage
{
public Sample()
{
InitializeComponent();
}
private void PopUpEntry_Focused(object sender, FocusEventArgs e)
{
viewModel.Text = (sender as Entry).Text;
}
private void GestureRecognizer_Tapped(object sender, System.EventArgs e)
{
popupLayout.IsOpen = true;
popupLayout.Focus();
}
}
public class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string text;
public string Text
{
get { return text; }
set
{
text = value;
NotifyPropertyChanged();
}
}
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.