locked
Settings that doesn't exist RRS feed

  • Question

  • Good afternoon. I want to use a setting page in Windows Phone 8, so I've read the article about how to create a settings page for Windows Phone and about how to use a button to save settings.

    Everything works fine, or at least that it what it is supposed to be, because after adding

    xmlns:local="clr-namespace:SettingsSample"
    and later
    <phone:PhoneApplicationPage.Resources>
        <local:AppSettings x:Key="appSettings"></local:AppSettings>
    </phone:PhoneApplicationPage.Resources>

    an error message said that AppSettings doesn't exist in Settings sample namespace.

    Maybe, I'm wrong, but can anyone teach me how to do it?

    Thanks.






    Friday, February 14, 2014 8:50 PM

Answers

  • When you created your project, did you name it "SettingsSample"? If you named your project something else, you need to use that name in the xmlns line. By default, the namespace is the name of the project.

    You can download the completed sample project and compare it with yours:
    http://code.msdn.microsoft.com/wpapps/Settings-Sample-4900bb1b

    • Marked as answer by juplagon Saturday, February 15, 2014 6:53 PM
    Friday, February 14, 2014 10:07 PM
  • Hi,

    first of all, when you use SettingsSample for xmlns:local ou need to have the same namespace in your AppSettings file/class and it needs to be SettingsSample.

    Then, if your AppSettings file is in root of your Visuals Studio project, then when you type local: in PhoneApplicationPage.Resources you need to get list of all files/class from the root of your Project.

    If you don't get like this:

    then your AppSettings file is not in right folder or you don't have correct namespace in AppSettings file.

    But if you get AppSettings right after local: then sometimes Compiler is complaining that it can't find the right resources although Build process is without errors. Then you need to close the VS solution and open it againg.

    Best regards


    Spaso Lazarevic


    • Edited by Spaso Lazarevic Saturday, February 15, 2014 1:29 PM spelling errors
    • Marked as answer by juplagon Saturday, February 15, 2014 6:53 PM
    Saturday, February 15, 2014 1:28 PM

All replies

  • When you created your project, did you name it "SettingsSample"? If you named your project something else, you need to use that name in the xmlns line. By default, the namespace is the name of the project.

    You can download the completed sample project and compare it with yours:
    http://code.msdn.microsoft.com/wpapps/Settings-Sample-4900bb1b

    • Marked as answer by juplagon Saturday, February 15, 2014 6:53 PM
    Friday, February 14, 2014 10:07 PM
  • Thanks for all, but I can't make it work on my project.

    Is there another way to do it?

    Thanks.

    Saturday, February 15, 2014 12:41 PM
  • Hi,

    first of all, when you use SettingsSample for xmlns:local ou need to have the same namespace in your AppSettings file/class and it needs to be SettingsSample.

    Then, if your AppSettings file is in root of your Visuals Studio project, then when you type local: in PhoneApplicationPage.Resources you need to get list of all files/class from the root of your Project.

    If you don't get like this:

    then your AppSettings file is not in right folder or you don't have correct namespace in AppSettings file.

    But if you get AppSettings right after local: then sometimes Compiler is complaining that it can't find the right resources although Build process is without errors. Then you need to close the VS solution and open it againg.

    Best regards


    Spaso Lazarevic


    • Edited by Spaso Lazarevic Saturday, February 15, 2014 1:29 PM spelling errors
    • Marked as answer by juplagon Saturday, February 15, 2014 6:53 PM
    Saturday, February 15, 2014 1:28 PM
  • Does the sample that I linked earlier work when you build and run it?

    You are not giving us enough information to help you. What is the namespace in your code? Show us your xaml and C# where you define the namespace.

    Saturday, February 15, 2014 5:36 PM
  • Thanks you both. I've solved my problem.

    The sample was giving me an error in the same line about the indentity of the caller, in my project, I was using the code of the guide inside the mainpage instead of creating a new class.

    Sorry if I've bother you two a lot.

    Thanks again.

    Saturday, February 15, 2014 6:19 PM