UWP - 如何在 "MasterDetailsView" 模板中实现数据输入表单?

UWP - How to implement a data entry form in "MasterDetailsView" template?

我有一个使用 Windows Templating Studio 制作的 MasterDetails 视图,我想使用 "Noselection" 状态来实现数据输入表单。

但是...我完全不知道该从哪里开始...

(我知道如何强制显示 NoSelection 显示,将 "Selected" 值设置为空。)

任何帮助都会很好!

[编辑 1]

    <DataTemplate x:Key="NoSelectionContentTemplate">
        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <views:AddContrat />
            <!--TextBlock
                x:Uid="Contrats_NoSelection"
                HorizontalAlignment="Center"
                VerticalAlignment="Center"
                Style="{StaticResource SubtitleTextBlockStyle}"
                TextAlignment="Center" /-->
        </Grid>
    </DataTemplate>

但是...有一个错误:

Severity Code Description Project File Line Suppression State Detail Description Error XDG0062 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Data.Sqlite.SqliteException: SQLite Error 1: 'no such table: Residences'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext() at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext() at Microsoft.Data.Sqlite.SqliteDataReader.N GestionGarages ContratsPage.xaml 38 System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Data.Sqlite.SqliteException: SQLite Error 1: 'no such table: Residences'. at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db) at Microsoft.Data.Sqlite.SqliteCommand.PrepareAndEnumerateStatements(Stopwatch timer)+MoveNext() at Microsoft.Data.Sqlite.SqliteCommand.GetStatements(Stopwatch timer)+MoveNext() at Microsoft.Data.Sqlite.SqliteDataReade

代码编译 运行 没问题...

此错误的可能原因是什么?

UWP - How to implement a data entry form in “MasterDetailsView” template?

MasterDetailsView 有 NoSelectionContentTemplate 属性,您可以像下面这样在此处放置数据条目。

<controls:MasterDetailsView.NoSelectionContentTemplate>
                <DataTemplate>
                    <StackPanel HorizontalAlignment="Center" 
                                VerticalAlignment="Center">
                        <SymbolIcon Symbol="Mail" 
                                    RenderTransformOrigin=".5,.5">
                            <SymbolIcon.RenderTransform>
                                <CompositeTransform 
                                  ScaleX="2" 
                                  ScaleY="2"/>
                            </SymbolIcon.RenderTransform>
                        </SymbolIcon>
                        <TextBlock Text="Please select item" 
                                   FontSize="24" 
                                   Margin="0,12"/>
                    </StackPanel>
                </DataTemplate>
</controls:MasterDetailsView.NoSelectionContentTemplate>