![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | First Shown event? Is there an equivelent of the Forms 'Shown' event for when a control is first shown? I have a TabControl with several TabItems. Each TabItem contains a TreeView which is populated by a WebService. I only want to call the WebService when the TreeView is displayed for the first time. Thanks Michael |
My System Specs![]() |
| | #2 (permalink) |
| | Re: First Shown event? Try the Loaded event. "MichaelG" <MichaelG@newsgroups.nospam> wrote in message news:OU%237IHpTGHA.4600@TK2MSFTNGP11.phx.gbl... > Is there an equivelent of the Forms 'Shown' event for when a control is > first shown? > > I have a TabControl with several TabItems. Each TabItem contains a > TreeView which is populated by a WebService. I only want to call the > WebService when the TreeView is displayed for the first time. > > Thanks > Michael > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: First Shown event? Hi Jason, I've tried that. Loaded seems to get fired for each TabItem and TreeView when the TabControl is rendered. This is from the 'Object Lifetime Events' entry in the SDK:- Loaded is raised next and is tied to either the source hookup (for top level windows) or visual parent hookup (for anything that isn't a window). In the Loaded event you are guaranteed that all child elements of the event source element are constructed, but not that all of their Loaded events has completed. Loaded is fired after the first render is completed. Standard data binding will have occurred prior to Loaded, asynchronous data binding may have occurred. The above seems a little ambiguous. First it says the event is tied to visual parent hookup and then it says it is fired after the element is rendered. I would have thought the TreeViews on the unselected tabs had not been rendered but the event fires anyhow. (n.b. there isn't any databinding set on any of these element) Some sort of PreFirstRender event would be very useful but it doesn't look like WPF has such a thing. Michael "Jason [Mobiform]" <Jason@mobiform.com> wrote in message news:%23$fBzRpTGHA.4384@tk2msftngp13.phx.gbl... > Try the Loaded event. > > > "MichaelG" <MichaelG@newsgroups.nospam> wrote in message > news:OU%237IHpTGHA.4600@TK2MSFTNGP11.phx.gbl... >> Is there an equivelent of the Forms 'Shown' event for when a control is >> first shown? >> >> I have a TabControl with several TabItems. Each TabItem contains a >> TreeView which is populated by a WebService. I only want to call the >> WebService when the TreeView is displayed for the first time. >> >> Thanks >> Michael >> > > |
My System Specs![]() |
| | #4 (permalink) |
| | Re: First Shown event? The .Initialized event might be what you're looking for. Its just a blind guess on my part, I'm not exactly sure at what point it gets triggered. J "MichaelG" <MichaelG@newsgroups.nospam> wrote in message news:eiGrEYyTGHA.4520@TK2MSFTNGP10.phx.gbl... > Hi Jason, > > I've tried that. Loaded seems to get fired for each TabItem and TreeView > when the TabControl is rendered. > > This is from the 'Object Lifetime Events' entry in the SDK:- > > Loaded is raised next and is tied to either the source hookup (for top > level windows) or visual parent hookup (for anything that isn't a window). > In the Loaded event you are guaranteed that all child elements of the > event source element are constructed, but not that all of their Loaded > events has completed. Loaded is fired after the first render is completed. > Standard data binding will have occurred prior to Loaded, asynchronous > data binding may have occurred. > > The above seems a little ambiguous. First it says the event is tied to > visual parent hookup and then it says it is fired after the element is > rendered. I would have thought the TreeViews on the unselected tabs had > not been rendered but the event fires anyhow. (n.b. there isn't any > databinding set on any of these element) > > Some sort of PreFirstRender event would be very useful but it doesn't look > like WPF has such a thing. > > Michael > > > > "Jason [Mobiform]" <Jason@mobiform.com> wrote in message > news:%23$fBzRpTGHA.4384@tk2msftngp13.phx.gbl... >> Try the Loaded event. >> >> >> "MichaelG" <MichaelG@newsgroups.nospam> wrote in message >> news:OU%237IHpTGHA.4600@TK2MSFTNGP11.phx.gbl... >>> Is there an equivelent of the Forms 'Shown' event for when a control is >>> first shown? >>> >>> I have a TabControl with several TabItems. Each TabItem contains a >>> TreeView which is populated by a WebService. I only want to call the >>> WebService when the TreeView is displayed for the first time. >>> >>> Thanks >>> Michael >>> >> >> > > |
My System Specs![]() |
| | #5 (permalink) |
| | Re: First Shown event? No, Initialized is the first event to fire before Loaded. Thanks anyway. Michael "Jason [Mobiform]" <Jason@mobiform.com> wrote in message news:Ovv1V52TGHA.5172@TK2MSFTNGP12.phx.gbl... > The .Initialized event might be what you're looking for. Its just a blind > guess on my part, I'm not exactly sure at what point it gets triggered. > > J > > > "MichaelG" <MichaelG@newsgroups.nospam> wrote in message > news:eiGrEYyTGHA.4520@TK2MSFTNGP10.phx.gbl... >> Hi Jason, >> >> I've tried that. Loaded seems to get fired for each TabItem and TreeView >> when the TabControl is rendered. >> >> This is from the 'Object Lifetime Events' entry in the SDK:- >> >> Loaded is raised next and is tied to either the source hookup (for top >> level windows) or visual parent hookup (for anything that isn't a >> window). In the Loaded event you are guaranteed that all child elements >> of the event source element are constructed, but not that all of their >> Loaded events has completed. Loaded is fired after the first render is >> completed. Standard data binding will have occurred prior to Loaded, >> asynchronous data binding may have occurred. >> >> The above seems a little ambiguous. First it says the event is tied to >> visual parent hookup and then it says it is fired after the element is >> rendered. I would have thought the TreeViews on the unselected tabs had >> not been rendered but the event fires anyhow. (n.b. there isn't any >> databinding set on any of these element) >> >> Some sort of PreFirstRender event would be very useful but it doesn't >> look like WPF has such a thing. >> >> Michael >> >> >> >> "Jason [Mobiform]" <Jason@mobiform.com> wrote in message >> news:%23$fBzRpTGHA.4384@tk2msftngp13.phx.gbl... >>> Try the Loaded event. >>> >>> >>> "MichaelG" <MichaelG@newsgroups.nospam> wrote in message >>> news:OU%237IHpTGHA.4600@TK2MSFTNGP11.phx.gbl... >>>> Is there an equivelent of the Forms 'Shown' event for when a control is >>>> first shown? >>>> >>>> I have a TabControl with several TabItems. Each TabItem contains a >>>> TreeView which is populated by a WebService. I only want to call the >>>> WebService when the TreeView is displayed for the first time. >>>> >>>> Thanks >>>> Michael >>>> >>> >>> >> >> > > |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| event ID 3002 on tcp.sys integrity and event ID 10 on WMI sesclu | Vista General | |||
| Re: event ID 3002 on tcp.sys integrity and event ID 10 on WMI sesclu | Vista General | |||
| HELP need to solve this problem asap - Unable to start event viewer/event log service | Software | |||
| Boot up Issues - Critical Event Log errors - Event ID = 100, 200, 400, 307, 402 | General Discussion | |||
| Windows Event Log fails to translate event description. | Vista General | |||