Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - First Shown event?

 
 
Old 03-23-2006   #1 (permalink)
MichaelG


 
 

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 SpecsSystem Spec
Old 03-23-2006   #2 (permalink)
Jason [Mobiform]


 
 

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 SpecsSystem Spec
Old 03-24-2006   #3 (permalink)
MichaelG


 
 

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 SpecsSystem Spec
Old 03-24-2006   #4 (permalink)
Jason [Mobiform]


 
 

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 SpecsSystem Spec
Old 03-24-2006   #5 (permalink)
MichaelG


 
 

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 SpecsSystem Spec
 

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46