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 7908621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:01:52+00:00 2026-06-03T12:01:52+00:00

I need to do some visual effects on the control after a particular ICommand

  • 0

I need to do some visual effects on the control after a particular ICommand was executed. For example, my Custom control exposes AAACommand and BBBCommand properties.

<myControl AAACommand={Binding ACommand}
           BBBCommand={Binding BCommand} />

where ACommand and BCommand are Commands on ViewModel. How do I know when AAACommand was executed, so I can do some UI stuff in my UserControl? there is no Executed event for ICommand to subscribe to.

Edit: AAACommand is defined like this on my user control:

public static readonly DependencyProperty AAACommandProperty =
        DependencyProperty.Register("AddCommand", typeof(RelayCommand), typeof(MyCustomControl), null);

public static readonly DependencyProperty AAACommandParameterProperty =
        DependencyProperty.Register("AAACommandParameter", typeof(object), typeof(MyCustomControl), null);

public RelayCommand AAACommand
{
    get { return (RelayCommand)GetValue(AAACommandProperty); }
    set { SetValue(AAACommandProperty, value); }
}

public object AAACommandParameter
{
    get { return (object)GetValue(AAACommandParameterProperty); }
    set { SetValue(AAACommandParameterProperty, value); }
}

So, there is no problem in invoking ACommand on ViewModel, this works without problem. The problem is how will my user control know when AAACommand will execute ACommand, so it can do something with its UI.

  • 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-03T12:01:55+00:00Added an answer on June 3, 2026 at 12:01 pm

    You want to update the usercontrol based upon a response returned from the view model and the command executed? I asked a question similar in nature where I wanted to pass as string value from one user control to another user control. I accomplished this using INotifyProperty Changed event. You can read the original question and solution here

    Update to comment:

    Base on your comment it seems like one of two things could happen. If you don’t need the VM to respond then the update could be triggered by elements in the view. You could do this using Binding ElementNameProperty. This in essence allows you to trigger/change a property based upon the action of another element. (typing text in one field displays the value in another control) Here is the msdn description and example .

    If you need it to be invoked based upon the return (i.e. success or failure) then the ViewModel will need to have a property (like a bool) that is bound two-way to the property of the element in the ui.
    You may need to create a converter (inheriting IValueConverter ) to handle the binding but INotifyProp Change would be used to marshal the update between the controls or the bound elements within them.

    Here is a quick example:

    within my xaml I added a user control that I did not want to be visible within the UI until another button within a secondary usercontrol was clicked. To handle this I setup binding on the Visibility property

    <ctrl:LandingPage x:Name="ucLandingPage"
                                      Grid.Row="1" 
                                      DataContext="{Binding}"  
                                      Visibility="{Binding LandingPageVisibility, Mode=OneWay, Converter={StaticResource LandingPageVisibilityConverter}}"/>
    

    Within the viewmodel I had the following property and code

    // Default ctor
            public SearchViewModel()  
            {
                //Show that the Landing Page control is being displayed
                SearchVisibility = Visibility.Collapsed;
    }
    

    property in VM (note I use SimpleMVVM framework which has Inotify included in the base object so my notify prop event may look a bit different from yours)

     private Visibility _SearchVisibility;
                public Visibility SearchVisibility
                {
                    get { return _SearchVisibility; }
                    set
                    {
                        _SearchVisibility = value;
                        NotifyPropertyChanged(m => m.SearchVisibility);
                    }
                }
    

    Then the method within the VM that updated this property

     public void GetSearchResult()
            {
                currentPage = 1;
                //Set the visibility of the search control in the center of the page
                SearchVisibility = Visibility.Visible;
                this.SearchHistory = this._DataModel.AddSearchHistoryItem(this.SearchTerm);
            }
    

    And finally the converter class which would convert the return value to the correct property value for the element

      public class SearchVisibilityConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
            {
                if (value != null & System.Convert.ToString(value) == "Visible")
                {
                    return Visibility.Visible;
                }
                else
                {
                    return Visibility.Collapsed;
                }
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
            {
                throw new NotImplementedException();
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is a problem: after loading some visual elements, I need to change something
Need some assistance with my Visual Studio projects and in particular with release process.
I have created setup project with Visual Studio. I also need some custom actions
I need to compile some mfc code that was written using Visual C++ 6.0
I need to work with some old C++ code that was developed in Visual
I need some sources like articles and books about visual studio 2010 team foundation
I'm making a visual studio 2010 extension and need some storage to store some
i need some information i have developed one windows appliaction in Visual studio 2008
I need to form an image by composing some visual elements and save it
I am pretty new to Visual Studio and .net framework and I need some

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.