Border の可視性を 10 秒間表示できるように設定できる必要があります。境界線は、Content.xaml の親である MainPage.xaml にあります。トリックは、MainPage.xaml に UserControl として読み込まれる Content.xaml からアクセスできる ContextMenu 項目をクリックして、境界線の可視性を変更する必要があることです。また、データグリッドのセル値に基づく条件付きベースにする必要があります。MainPage.xaml の境界線の可視性を条件付きで変更するメソッドを Content.xaml に確立しました。境界線は範囲外なので、配線できる方法を見つける必要があります。
データグリッドのセル値のコンテンツに基づいて可視性を設定するコード:
private void Delete(object sender, RoutedEventArgs e)
{
Packages_DataViewModel currentItem = MasterTile.SelectedItem as Packages_DataViewModel;
if (currentItem.Status != "has content")
{
this.MainPageBorder.Visibility = Visibility.Visible;
}
else
{
mv.DeletePackagesItem((Packages_DataViewModel)(MasterTile.SelectedItem));
}
}
また、Content.xaml で使用するメソッドを実行して、MainPage.xaml のボタンからデータ グリッド コンテンツを変更する必要もあります。どんなアイデアでも大歓迎です!
セル値を更新するコード:
private void Status(object sender, RoutedEventArgs e)
{
Packages_DataViewModel currentItem = MasterTile.SelectedItem as Packages_DataViewModel;
currentItem.Status = "has content";
this.MainPageBorder.Visibility = Visibility.Collapsed;
}