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

  • SEARCH
  • Home
  • 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 405773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:25:54+00:00 2026-05-12T17:25:54+00:00

I am having trouble trying to get a click event to fire after the

  • 0

I am having trouble trying to get a click event to fire after the command gets executed. I am trying to follow the MVVM style of development.

Here is the scenario:

In my application I have a grid of 2 by N buttons, where N is a dynamically loaded set of buttons (sometimes it’ll be 2 x 2, sometimes its 5 x 9, I don’t know). Initially, all the columns of buttons will be hidden except for the first column. Upon clicking the first column, a Command gets executed, and a fade in animation gets played and shows certain buttons from the second column, depending on which button was clicked in the first column. For example, clicking the top button in the first column will reveal the first four buttons in the second column, whereas the bottom button in the first column will reveal the first three buttons in the second column.

Here’s the problem:

For each button, I set a CommandParameter to each of the buttons in the first column. When the command gets executed, data gets processed, and a property is set in the VM that says which button was pressed (I just use the CommandParameter again). While the data is being processed, I want to display the next set of buttons to the user. I have a click event that takes the CommandParameter from the VM and plays an animation to show the proper buttons.

However, the problem is that WPF likes to do the Click event first before the Command gets fired. This is a problem since the property in the VM that says which button was clicked doesn’t get set!

So that brings me to a couple questions…

1) Is there a way to execute the command before firing the event?

2) Am I doing it right? 😛

  • 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-05-12T17:25:54+00:00Added an answer on May 12, 2026 at 5:25 pm

    Instead of using a click event handler, you could just setup DataTriggers on your buttons.

    They could respond to the property in your ViewModel, hiding buttons you don’t want displayed, and showing the button you do.

    The nice thing about this is that your View can be done completely in XAML, and the ViewModel is just setting state (ie: I’m at this state), and the View will automatically stay updated since the binding will cause the new DataTrigger to fire.

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

Sidebar

Related Questions

I am having a bit of trouble trying to figure out how to get
I'm having a little trouble trying to get WarpPointer to work out appropriately for
When building PHP applications I always end up having trouble trying to get everything
Hey, i'm trying to get a project to work, but i am having trouble
Hello trying to get my website to display correctly having trouble. I am using
I'm having some trouble using trying to determine if a mouse click is occurring
I am new to jQuery and having some trouble trying to get the success
I'm trying to write a Greasemonkey script for Facebook and having some trouble with
I am having trouble with loading JSON into an app that im creating $(#load_basic).click(function(){
I'm having some trouble with an Ajax script which disables my jQuery click events.

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.