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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:37:17+00:00 2026-06-16T20:37:17+00:00

I created boolean variable for sound with app settings in this msdn articles .

  • 0

I created boolean variable for sound with app settings in this msdn articles. Now I want it in my menu as toggleswitch which can set volume on or off. I am thinking about using something like this this answer. But I am not sure if it is good for my problem. Should I add a variable for image to my AppSettings or is there a better way for doing this?

My solution:

In xaml:

<ToggleButton Name="tgbSound" BorderThickness="0" Background="Transparent"
                      Checked="tgbSound_Checked"
                      Unchecked="tgbSound_Unchecked"
                      IsChecked="{Binding Source={StaticResource appSettings}, Path=SoundSetting, Mode=TwoWay}">
        </ToggleButton>

In code for xaml page:

private void tgbSound_Checked(object sender, RoutedEventArgs e)
{
    SetTgbSoundContentTo("Images/volumeon.png");
}

private void tgbSound_Unchecked(object sender, RoutedEventArgs e)
{
    SetTgbSoundContentTo("Images/volumeoff.png");
}

private void SetTgbSoundContentTo(string uri)
{
    Image volumeoff = new Image();
    ImageSource zdroj = new BitmapImage(new Uri(uri, UriKind.Relative));
    volumeoff.Source = zdroj;
    volumeoff.Height = 40;
    if (tgbSound == null)
        return;
    tgbSound.Content = volumeoff;
    tgbSound.Background = new SolidColorBrush(Colors.Transparent);
}
  • 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-16T20:37:18+00:00Added an answer on June 16, 2026 at 8:37 pm

    You can do both. For both the methods, I will suggest you a common approach.

    Create a Boolean property in your AppSettings and create its wrapper inside your viewmodel.
    Then bind (two way) the wrapper property in your view model to your UI element, that can be both a toggle switch or an image. In case of toggleswitch, the two way binding will itself do the trick, but for an image you will have to handle the tap event and handle the on/off states and Boolean values in the code yourself.

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

Sidebar

Related Questions

I want to share a variable between multiple threads like this: boolean flag =
I created a Heroku app which utilizes the gmaps4fails gem for one of the
I have a arduino project and I created this struct: struct Project { boolean
I've created a simple Project model with four attributes: Project name:string description:text complete:boolean user_id:integer
I created a JButton which has an image set as an icon representing the
I want to customize the 'new' and 'edit' pages in rails scaffolding. Where can
I have created a scroll div which works and is fine. However, my boss
I've created a component which is basically a meter (extends skinnable container). The skin
I'm having some trouble writing a hashCode() method for a class I created. This
This is the code I created for exporting the database. The problem is, the

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.