0

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.

NoobieNeedHelp
  • 85
  • 1
  • 1
  • 9
  • 1
    What doesn't work? Please state the problem. – Silvermind Jan 09 '14 at 12:29
  • please make it clear, what did you mean doesn't work? was it error, or you didn't see *the expected result*, and what is it *the expected result* exactly? – har07 Jan 09 '14 at 12:57

4 Answers4

0

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

clearGraphics_click(sender,e);
Bridge
  • 29,818
  • 9
  • 60
  • 82
Prajul G
  • 184
  • 1
  • 8
0
  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"?

har07
  • 88,338
  • 12
  • 84
  • 137
  • wont work meaning it wont clear the graphic on the map, while i manuelly click the method of clearGraphics_click, it cleared. But when put on this.loaded. It wont work – NoobieNeedHelp Jan 09 '14 at 14:45
  • kinda weird, assuming you don't use those 2 methods parameter inside the method code, there shouldn't be any difference wherever it called. Maybe somehow (asynchoronous execution or sth) your code populated the graphic after calling `clearGraphics_click`, not very sure – har07 Jan 09 '14 at 15:00
0

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

Hallur A.
  • 299
  • 1
  • 3
  • 13
0

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

NoobieNeedHelp
  • 85
  • 1
  • 1
  • 9