locked
how to set This key value throw code

    Question

  • Hi,

    I am need set the Integer values throw code in my app using c ++ language . The code as follows . Is it possible to access and give value to Key ? .

     

    <

    Page.Resources>

    <x:Double x:Key="key">-294</x:Double>

    </

    Page.Resources>


    Friday, August 17, 2012 11:34 AM

Answers

  • Hi Sarath,

    You are trying to create a StaticResource which can only be created in XAML (or in Resource Dictionary) at design time as they are static. In the Windows Runtime XAML processor implementation, there is no backing class representation. StaticResource is exclusively for use in XAML, using the "{}" syntax that indicates to a XAML processor that the contents should be treated by a markup extension.

    -Sagar


    • Marked as answer by Bilaal John S Monday, August 20, 2012 1:31 PM
    Monday, August 20, 2012 12:01 PM
    Moderator

All replies

  • If you are writing this code in the XAML of MainPage.xaml, then you can access it in the code-behind as :

    MainPage::Resources["key"]

    -Sagar

    Friday, August 17, 2012 1:18 PM
    Moderator
  • hi,

    I need to set value to key throw code . How it is possible throw above code ..?

    -Sarath s  

    Saturday, August 18, 2012 3:42 AM
  • Hi Sarath,

    You are trying to create a StaticResource which can only be created in XAML (or in Resource Dictionary) at design time as they are static. In the Windows Runtime XAML processor implementation, there is no backing class representation. StaticResource is exclusively for use in XAML, using the "{}" syntax that indicates to a XAML processor that the contents should be treated by a markup extension.

    -Sagar


    • Marked as answer by Bilaal John S Monday, August 20, 2012 1:31 PM
    Monday, August 20, 2012 12:01 PM
    Moderator
  • hi sargar,

    thank you for your valuable informations.

    regards,

    Sarath s

    Monday, August 20, 2012 1:31 PM