UWP Inherit parent page from child page

득권 천 61 Reputation points

Hello I am a student who has just started studying UWP


A structure is a structure that has frames within a page and moves through navigation.

I want to create a button that is retrieved from a page belonging to a frame in the parent page and then override it so that the logic works when pressed in the lower page


public ShellViewModel()  
            Action_Search_Command = new DelegateCommand(Action_Search);  
        protected virtual void Action_Search()  


protected override void Action_Search()  

I created a lookup button and command in the shell page and overridden it in the page corresponding to the frame to call the function to bind the datagrid, but it didn't work.

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,826 Reputation points

    Welcome to Microsoft Q&A!

    Your problem is more related with C# polymorphism. If you want to ShellViewModel could call the sub-class override method, you should use father reference point to sub-class instance.


    public MainPage()  
        Instance = this;  
        this.DataContext = new OM_01ViewModel() as ShellViewModel;  
    public static MainPage Instance;  


    public CorePage()  
        this.DataContext = MainPage.Instance.DataContext as OM_01ViewModel;  

    Thank you.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful