locked
Widnows 8.1 Store App template?

    Question

  • Hi there,

    I'm just starting to learn how to create Windows 8.1 Store App with C#, and this is a newbie question.

    Running Windows 8.1 and VS Express 2013, the installed Store App template seems to be for Windows 8 not for Windows 8.1

    I checked solution property and the target platform is indeed Windows 8.1 but still, when I add "New Item" as "Store App -> Basic Page" I still see <Button> is being used instead of <AppbarButton>, and there's no BooleanToVisibilityConverter in Common. I tried reinstall Express 2013 but that didn't help.

    So, is it the way it is that I need to manually change <Button> to appbarbutton and add that missing converter, or I'm missing something?

    Thanks in advance!

    Sunday, March 16, 2014 3:32 PM

Answers

  • Hi Ic1396,

    What do you mean by Button is used instead of AppbarButton? Generally AppBarButton classis inheritance from Button. We can say it is a button, but I cannot understand what do you mean here. You can add AppBarButton by xaml or by C# code, should be fine.  

    Meanwhile BooleanToVisibilityConverter is removed when adding Basic Page for win8.1 app, you can use the following code instead if you need, the code is from win8.0 project.

      public sealed class BooleanToVisibilityConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, string language)
            {
                return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                return value is Visibility && (Visibility)value == Visibility.Visible;
            }
        }

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Ic1396 Monday, March 17, 2014 8:30 PM
    Monday, March 17, 2014 8:47 AM
    Moderator

All replies

  • Hi Ic1396,

    What do you mean by Button is used instead of AppbarButton? Generally AppBarButton classis inheritance from Button. We can say it is a button, but I cannot understand what do you mean here. You can add AppBarButton by xaml or by C# code, should be fine.  

    Meanwhile BooleanToVisibilityConverter is removed when adding Basic Page for win8.1 app, you can use the following code instead if you need, the code is from win8.0 project.

      public sealed class BooleanToVisibilityConverter : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, string language)
            {
                return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
            }
    
            public object ConvertBack(object value, Type targetType, object parameter, string language)
            {
                return value is Visibility && (Visibility)value == Visibility.Visible;
            }
        }

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Ic1396 Monday, March 17, 2014 8:30 PM
    Monday, March 17, 2014 8:47 AM
    Moderator
  • Hi James, 

    Thank you for the answer, and it seems clear now that I was confused by the examples in the book I'm reading - that code made me believe the <AppbarButton> was *automatically* generated by the IDE for you, as well as that boolean converter, that they are all part of a 'windows 8.1 store app template'. That's why I was wondering if I have the 8.1 templates.  Now as you said, it is the other way around - that converter was in 8.0 template but no longer in 8.1

    Thanks again, James!

    Monday, March 17, 2014 8:29 PM