onload to trigger a button click (WP7)

160 views Asked by At

I need to trigger a application bar onclick method onload of the page. I have the following methods.

 public MapPage()
        {
            InitializeComponent();
            this.Loaded += MapPage_Loaded;
        }
        void MapPage_Loaded(object sender, RoutedEventArgs e)
        {
            abc_Checked(null, null);
            efc_Checked(null, null);

            String selected = amenties[0];
            httpRequest(selected);


         }

This is the method i would like to call in the onload.

 private void clearGraphics_click(object sender, EventArgs e)

Can someone guide me on how to correctly run this clearGraphics_click on load? I tried clearGraphics_click(null,null); It wont work.

4

There are 4 answers

0
NoobieNeedHelp On BEST ANSWER

Used a Visible="False" on the graphic layers hides the points that is shown.

1
Prajul G On

Did you try sending the same objects in the MapPage_Loaded function? Like this:

clearGraphics_click(sender,e);
2
har07 On
  1. Put logic in clearGraphics_click to a separate function then call that function in MapPage_Loaded.
  2. just put this clearGraphics_click(null, null); in MapPage_Loaded if you don't make use of the two parameters in the code.

And how do you mean "it won't work"?

0
Hallur A. On

I'm not familiar with WP7 programming, but try adding this.Loaded += clearGraphics_click; after this.Loaded += MapPage_Loaded; in the constructor