Results 1 to 2 of 2

Thread: How to Programatically click a Button on a navigated Frame Page

  1. #1

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    How to Programatically click a Button on a navigated Frame Page

    Good Day all

    i am using Navigation service as depicted below

    Code:
    <Frame x:Name="_home"     NavigationUIVisibility="Hidden" HorizontalAlignment="Stretch"   Width="2749" Margin="0,12,0,0"   />
    and i navigate to the Page like this

    Code:
    (Application.Current.MainWindow.FindName("_home") as Frame).Source = new Uri("/F1.xaml", UriKind.Relative);

    which work fine. now in the Navigated page, lets just say a page shown in the Frame,there is some functionality like Calculate ,e.g that calculates Age based on the years(Example). Now from the Main Page i have a Button that says Calculate , i want to call the function or invoke a button click of Frame page from the Main Page.

    Well i have tried this from the main page


    Code:
        private void btnCalculate_Click(object sender, RoutedEventArgs e)
            {
                F1 f1 = new F1(); 
                f1.CalculateYear();
            }


    no but does not work, the break-point does reach the F1 page but the UI does not have calculated results.

    One other thing i tried earlier is to pass the value that will be used in the calculation from the main , but when the one follow the variable value they just return an empty string when you follow it while stepping through it.

    How is this done

    Thanks

  2. #2

    Thread Starter
    Fanatic Member vuyiswamb's Avatar
    Join Date
    Jan 2007
    Location
    South Africa
    Posts
    830

    Re: How to Programatically click a Button on a navigated Frame Page

    Found a Solution

    Code:
    F1 f1 = new F1();
    to this

    Code:
     F1 f1 = (F1 )_home.Content;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width