V
V
vagitaku2019-08-01 00:48:03
WPF
vagitaku, 2019-08-01 00:48:03

How to access UI page elements loaded into a Frame from a Window element?

There is a Window element that has a XAML Frame element. The page is loaded there if necessary:

namespace N
{
    public partial class MainWindow : Window
    {
        private Page HiringPage;
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Hrirng_Click(object sender, RoutedEventArgs e)
        {
            HiringPage = new Pages.HiringPage();
            
            MainFrame.Content = null;
            MainFrame.Content = HiringPage;
        }

        private void FastPrint_Click(object sender, RoutedEventArgs e)
        {
             HiringPage. // тут я пытаюсь получить доступ к текстбоксам которые в HiringPage размещены. 

        }
    }
}

Googled something like this:
wpf get page cs from another window

wpf get page ui from another window

but didn't find anything that worked.
I tried to add such an attribute to the textbox - x:FieldModifier="public"- did not help. Then I thought to make a crutch and create a public method inside the HiringPage .cs file, which will return the data I need, but this does not work either.
I thought that the problem is that I am requesting data in a block in which I initialize the page. But no, in the Hrirng_Click block, I can’t access either the method or the data I need directly from the textboxes either.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Meiborn, 2019-08-01
@Meiborn

I think you will not be able to do this due to the fact that it is prohibited by browsers . This is one of the attacks, so it is not supported.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question