Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/294.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Xamarin:跨平台获取键盘高度_C#_Xaml_Xamarin.forms - Fatal编程技术网

C# Xamarin:跨平台获取键盘高度

C# Xamarin:跨平台获取键盘高度,c#,xaml,xamarin.forms,C#,Xaml,Xamarin.forms,我希望编写一个依赖项服务,以便在点击任何输入单元格后出现键盘时获得键盘高度 PCL中的接口 Xaml代码 IOS中的重写接口 任何人都可以提出实现这一点的建议。看看:android中的rootView和IOS中的NSNotificationCenter怎么样。我应该如何从PCL传递这些值。 public interface IKeyboardService { int GetHeight(); } <ContentPage.Content>

我希望编写一个依赖项服务,以便在点击任何输入单元格后出现键盘时获得键盘高度

PCL中的接口 Xaml代码 IOS中的重写接口
任何人都可以提出实现这一点的建议。

看看:android中的rootView和IOS中的NSNotificationCenter怎么样。我应该如何从PCL传递这些值。
public interface IKeyboardService
    {
        int GetHeight();
    }
 <ContentPage.Content> 
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>

            <StackLayout Grid.Row="1">
                <Entry Text="Tap to open the keyboard" Focused="entryUserName_Focused" />
                <Button Text="Submit" Clicked="Handle_Clicked" />
            </StackLayout>
        </Grid>     
    </ContentPage.Content>
   private void entryUserName_Focused(object sender, FocusEventArgs e)
        {
            int height= DependencyService.Get<IKeyboardService>().GetHeight();
        }
   public class Keyboard_Droid : IKeyboardService
    {
      public int GetHeight()
        {
            // Logic to implement
            return h;
        }
    }
public class Keyboard_IOS : IKeyboardService
        {
          public int GetHeight()
            {
                // Logic to implement
                return h;
            }
        }