2017-03-29 22 views
1
轉移

我建設通用的Windows平臺的應用程序,我已經把TextBox在屏幕的底部,但我不希望它在整個UI上移,而且我不想重新排列所有東西以適合鍵盤上方的位置。製作鍵盤去了UI不是整個UI在UWP

我只想做這樣的事情柯塔娜,該鍵盤可以將所有圖層的上方。

應用程序的樣子本身:

應用程序的樣子打開鍵盤後:

柯塔娜的樣子(這是什麼我希望我的應用可以像這樣):

<Page 
x:Class="Pi.MainPage" 
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
xmlns:local="using:Pi" 
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
mc:Ignorable="d" Loaded="Page_Loaded"> 
<Page.Resources> 
    <FontFamily x:Key="Dekar">/Assets/Fonts/Dekar.otf#Dekar</FontFamily> 
    <FontFamily x:Key="Consolas">/Assets/Fonts/SFThin.otf#SF UI Display</FontFamily> 
</Page.Resources> 

<Grid Background="Black"> 
    <Rectangle Margin="0"> 
     <Rectangle.Fill> 
      <ImageBrush ImageSource="Assets/MainBG2.jpg" Stretch="UniformToFill" Opacity="0.35"/> 
     </Rectangle.Fill> 
    </Rectangle> 
    <TextBlock x:Name="TitleText" Height="21" Margin="10,18,10,0" TextWrapping="Wrap" Text="ADMIN ACCESS" VerticalAlignment="Top" Foreground="#FF00AEFF" FontSize="20" FontFamily="{StaticResource Dekar}" TextAlignment="Center" DoubleTapped="TitleText_DoubleTapped"/> 
    <TextBox x:Name="CommandBox" Margin="0,0,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Bottom" FontFamily="{StaticResource Consolas}" Foreground="#FF8D8D8D" Background="#BF111E23" BorderThickness="0,1,0,0" FontSize="17" Height="50" PlaceholderText="Type here..." Padding="10,12,0,0" RequestedTheme="Dark" BorderBrush="#FF00AEFF" KeyUp="KeyPressed"/> 
    <ScrollViewer Margin="10,65,10,60" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"> 
     <TextBlock x:Name="ResultText" TextWrapping="Wrap" Text="What are your commands?" VerticalAlignment="Top" Foreground="#FFDEDEDE" FontSize="19" FontFamily="{StaticResource Consolas}" TextAlignment="Left"/> 
</Grid> 

+0

我無法發佈超過2個鏈接,所以我已經把一個空格後 「https:」 開頭。 – SaeedZeroOne

+1

你可以發佈你的'XAML'嗎? – AVK

+0

你可以發佈你的XAML代碼嗎?我想你沒有把你的文本框放在同一個容器中? –

回答

1

默認情況下,InputPane滑動頁面,以便聚焦元素不覆蓋鍵盤。您的頁面底部具有焦點文本框,因此必須向上滑動,以便用戶可以看到她的類型。

您可以通過處理InputPane.Showing事件並設置EnsuredFocusedElementInView屬性以使InputPane知道您已處理此操作並且不需要滑動來覆蓋此行爲。

您可以將文本框的正上方InputPane的OccludedRect而是獨自離開頁面的其餘部分,然後將文本框後面的InoutPane.Hiding。

+0

感謝您的回答。 – SaeedZeroOne