[C#/MAUI/.NET6] Entry 클래스 : On<T> 메소드를 사용해 소프트 키보드 사용자 작업 버튼 설정하기 (ANDROID)
C#/MAUI 2022. 6. 9. 12:57728x90
728x170
▶ MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage x:Class="TestProject.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<StackLayout
HorizontalOptions="Center"
VerticalOptions="Center"
Spacing="10">
<StackLayout
HorizontalOptions="Start"
Orientation="Horizontal"
Spacing="10">
<Label
VerticalOptions="Center"
Text="항목 1" />
<Entry x:Name="entry1"
VerticalOptions="Center"
MinimumWidthRequest="100"
Placeholder="값 1" />
</StackLayout>
<StackLayout
HorizontalOptions="Start"
Orientation="Horizontal"
Spacing="10">
<Label
VerticalOptions="Center"
Text="항목 2" />
<Entry x:Name="entry2"
VerticalOptions="Center"
MinimumWidthRequest="100"
Placeholder="값 2" />
</StackLayout>
</StackLayout>
</ContentPage>
728x90
▶ MainPage.xaml.cs
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;
namespace TestProject;
/// <summary>
/// 메인 페이지
/// </summary>
public partial class MainPage : ContentPage
{
//////////////////////////////////////////////////////////////////////////////////////////////////// Constructor
////////////////////////////////////////////////////////////////////////////////////////// Public
#region 생성자 - MainPage()
/// <summary>
/// 생성자
/// </summary>
public MainPage()
{
InitializeComponent();
Loaded += ContentPage_Loaded;
}
#endregion
//////////////////////////////////////////////////////////////////////////////////////////////////// Method
////////////////////////////////////////////////////////////////////////////////////////// Private
#region 컨텐트 페이지 로드시 처리하기 - ContentPage_Loaded(sender, e)
/// <summary>
/// 컨텐트 페이지 로드시 처리하기
/// </summary>
/// <param name="sender">이벤트 발생자</param>
/// <param name="e">이벤트 인자</param>
private void ContentPage_Loaded(object sender, EventArgs e)
{
// 생성자에서 실행하면 적용이 안된다.
this.entry1.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetImeOptions(ImeFlags.Send);
this.entry2.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().SetImeOptions(ImeFlags.Go );
}
#endregion
}
728x90
그리드형(광고전용)