Search code examples
c#xamlwindows-phone-8.1windows-10-mobile

How do I create a plus or minus button in my Windows Phone app using XAML?


I want to include a plus or minus button in my Windows Phone app. How can I change the content of the button to plus or minus?

<Button x:Name="buttonPlusOrMinus" 
            Content="+/-"
            HorizontalAlignment="Left" 
            Margin="180,217,0,0" 
            Grid.Row="2" 
            VerticalAlignment="Top"/>

Solution

  • There is a few ways to do this.

    • Hold down the Alt key then type 0177 on the numpad and let go of Alt, this will cause you to type ±.

    • Open up the program charmap in windows, find the character you are looking for, then click the "Select" then the "Copy" button. You will then be able to paste the ± character in your code.

    enter image description here

    • Copy the ± character from this question into your code.

      <Button x:Name="buttonPlusOrMinus" 
          Content="±"
          HorizontalAlignment="Left" 
          Margin="180,217,0,0" 
          Grid.Row="2" 
          VerticalAlignment="Top"/>