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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T20:10:26+00:00 2026-05-28T20:10:26+00:00

Hi basically I’ve been able to completely seperate my logic into a view model

  • 0

Hi basically I’ve been able to completely seperate my logic into a view model with the exception of one thing. I have a a button and two different templates that can be applied to the button. Basically when audio is playing one template is displayed and when its not the other is displayed. When I was using the code behind this was easy because I had access to the page’s Resources and all I had to do was set it accordingly. Now that my code is in the VM though I’m not really sure how to change the template.

The first thought that comes to mind is to maybe send a message to the view to change it when I need to. Is this the only way? I did see that WPF had triggers which looks pretty nice because you don’t have to send messages and no code is placed in the code behind. Has anyone found a work around for this?

  • 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-28T20:10:27+00:00Added an answer on May 28, 2026 at 8:10 pm

    You can probably write a ValueConverter that would look at a public bool IsPlaying property and transform it to the appropriate template. Then you can databind your Button template property to the IsPlaying property, using the converter as a translator.

    I haven’t tried this with templates, but I’ve used it to great success with Bitmap and Visibility, so I’m pretty sure it would work here as well.

    Here’s a good intro to ValueConverter, if you haven’t used one before.

    That said, messaging isn’t such a horrible solution in this case. Sometimes there is code that just wants to live in the codebehind file. Animation start/stop code is another example that comes to mind.

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

Sidebar

Related Questions

Basically what I have here is a button that adds a new list item
Basically I have converted a tab delimited txt file into a list containing a
Basically I have some code to check a specific directory to see if an
Basically, I'm trying to tap into the Soap pipeline in .NET 2.0 - I
Basically I'm trying to accomplish the same thing that mailto:bgates@microsoft.com does in Internet Explorer
Basically I have an asp.net website with login and search pages. Currently, I have
Basically I have a drop down list which is populated with text and values
basically i need to write a query for mysql, but i have no experience
Basically I have written a game plugin that will allow server admins to update
Basically i have a query string that when i hardcode in the catalogue value

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.