Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer peopleโ€™s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer peopleโ€™s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9179403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:47:14+00:00 2026-06-17T17:47:14+00:00

I can’t seem to find a way to detect when a panel finishes loading.

  • 0

I can’t seem to find a way to detect when a panel finishes loading. I’m adding a couple features to an already existing WPF/Prism project. I need to get called back when the page finishes rendering. I tried this:

In the UserControl at the top of the XAML that I need to get called back on when the page loads:

<UserControl x:....

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
...>

<i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <i:InvokeCommandAction Command="{Binding DoSomething}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>

Then in the code behind file:

public void DoSomething(object sender, EventArgs e)
{
     System.Diagnostics.Debug.WriteLine("received callback");
}

It currently does not work and I was not sure if this is the right path or not since I’m new to WPF, prism, and .NET.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T17:47:15+00:00Added an answer on June 17, 2026 at 5:47 pm

    Well I see you already know the answer… anyway…
    What you did wrong you had been binding event to command in your XAML and you didn’t have command ๐Ÿ™‚ Basicly you messed up standard “code-behind approach” with let’s say “MVVM approach”/binding.

    So when you touched the code-behind and created your DoSomethingEventHandler there you could simply

        <UserControl .. Loaded="UserControl_Loaded"> 
        .. 
        </UserControl>
    

    with your CodeBehind:

        private void UserControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            // Do Something
        }
    

    It would be fine… but it’s not MVVM :]

    Well and to your new approach (no code-behind/let’s say MVVM)…

    If you use Prism v4.1 you can look here this feature most people miss in Prism ๐Ÿ™‚ but there is solution mentioned ๐Ÿ™‚

    Well as you know you need ICommand you are binding to… It does not have to be DelegateCommand you can use what you want… (I prefer and use RelayCommand)

    Well but what we learned from aforementioned link?

    1. Sometimes… not this time… ICommand can change Controls enabled state and it’s not updated when you don’t use Prism's Interactivity and you simply use Blend SDK's Interactivity… You don’t need it this time… I admit… but maybe some day ๐Ÿ™‚
    2. And you don’t need those silly parameters in handler since you don’t get them anyway :D(When you need those Args You can use MVVM Light for example.)

    So the best you can do is this:

    <UserControl
        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
        xmlns:prism="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    ...    
    >
    ...
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Loaded">
            <prism:InvokeCommandAction Command="{Binding MyCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    

    and your ViewModel for example:

        public ICommand MyCommand
        {
            get
            {
                return new RelayCommand(this.MyCommandExecute);
            }
        }
    
        private void MyCommandExecute()
        {
            // DO Something...
        }
    

    Sorry that I unswered already answered question, but I thought I might add some interesting info ๐Ÿ™‚

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone enlighten me to a way I can Highlight the content of an
Can anybody tell me a regular expression to use within some PHP to find
Can anyone give me some tips on adding a custom button for each row
Can not find scala.actors package in latest milestones, while it still presents in scaladocs:
Can find why i get this error can someone help? package Android.data; public class
Can you have submenus with the top level set to checkable in WPF? I
Can anyone help me trying to find out why this doesn't work. The brushes
Can someone please tell me is there a way to solve difference equation e.g:
Can anybody let me know about a couple of open source projects that uses
Can someone please help me find the memory leak which is occurring here? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.