Вопрос

I need to be able to set the visibility of the Border to be visible for 10 seconds. The border resides in MainPage.xaml which is parent to Content.xaml. The trick is that I need to change the visibility of the border by clicking ContextMenu item that is accessible from Content.xaml which is loaded as a UserControl into MainPage.xaml. It is also should be conditional bases on the cell value in the datagrid. I established a method in Content.xaml which should conditionally change visibility of the border in MainPage.xaml. Since the border is out of the scope, I need to find a way to be able wire to it.

Code to set the visibility based on the content in cell value in datagrid:

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));
        }
    }

I also need to run a method which I use in Content.xaml to modify data grid content from a button in MainPage.xaml. Any ideas are highly appreciated!

Code to update the cell value:

private void Status(object sender, RoutedEventArgs e)
    {
        Packages_DataViewModel currentItem = MasterTile.SelectedItem as Packages_DataViewModel;
        currentItem.Status = "has content";
        this.MainPageBorder.Visibility = Visibility.Collapsed;
    }

Нет правильного решения

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top