我可能错过了一些基本的东西,但不知道是什么。
我正在将 Tempalate10 UWP 应用程序转换为 Windows Template Studio。
我已将大部分代码移至新项目,但令我印象深刻的是,当页面加载(导航到)时,并非所有内容都第一次加载。我第二次尝试,它加载了所有内容。我错过了什么?
添加代码:
<StackPanel Visibility="{x:Bind ViewModel.ItemFinalized, Mode=OneWay}">
<TextBlock TextWrapping="WrapWholeWords">This text</TextBlock>
<ToggleSwitch x:Name="toggleSwitchSaveCopies2"
Margin="0,0,0,0"
IsOn="{x:Bind ViewModel.SavePdfCopies, Mode=TwoWay}"
Visibility="{x:Bind ViewModel.HasLineItems, Mode=OneWay}"
OffContent="Don't save PDF copies."
OnContent="Save and show me the PDFs."></ToggleSwitch>
<ToggleSwitch x:Name="toggleSwitchComposeEmail2"
Margin="0,0,0,0"
IsOn="{x:Bind ViewModel.ComposeEmail, Mode=TwoWay}"
OffContent="Don't compose an email."
OnContent="Compose an email."></ToggleSwitch>
<Button x:Name="buttonSaveFinalized"
IsEnabled="{x:Bind ViewModel.CanSave, Mode=OneWay}"
Content="Save"
Margin="0,12,0,20"
Click="ButtonSaveFinalized_Click" />
<Button x:Name="buttonViewScanSheetPDF"
Content="Test"
Margin="0,25,0,20"
Click="ButtonViewScanSheetPDF_Click" />
</StackPanel>
视图模型:
public bool ItemFinalized { get => itemFinalized; set { Set(ref itemFinalized, value); RaisePropertyChanged("IsDraft"); } }