Windows SDK 1903 ExtendViewIntoTitleBar问题

时间:2019-06-26 01:50:19

标签: c# xaml uwp

我想将我的应用程序内容扩展到标题栏,但是 CoreApplication.GetCurrentView()。TitleBar.ExtendViewIntoTitleBar = true; 不起作用。

当SDk版本为1809时,这是正常的,然后我将SDK版本更新为1903,这不起作用。

如果我下降到1809或1803,那是可行的。因此,我认为这是1903 SDK中的错误,而不是我的代码的错误。


更新:

好,我尝试过。这是NavigationView的问题。

在xaml中:

<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="Black">

<Grid>
    <NavigationView 
        Background="Red" Header="asdasd">
        <Grid  >

            <CommandBar 
                        HorizontalAlignment="Right"
                        VerticalAlignment="Top"
                        DefaultLabelPosition="Right"
                        >
                <AppBarButton  Icon="Up"/>
                <AppBarButton  Icon="Shuffle"/>

            </CommandBar>
        </Grid>
    </NavigationView>

</Grid>

在App.xaml.cs中:

protected override void OnLaunched(LaunchActivatedEventArgs e)
    {
        Frame rootFrame = Window.Current.Content as Frame;

        var coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
        coreTitleBar.ExtendViewIntoTitleBar = true;

现在运行它,在1809版本中,Header扩展到标题栏,如下图所示: enter image description here

但是在1903年,相同的代码,相同的布局,只是SDK版本被更改,标头未插入标题栏和命令栏也下降了:

enter image description here

如何解决此问题?谢谢。

0 个答案:

没有答案
相关问题