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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:12:24+00:00 2026-05-19T02:12:24+00:00

With Windows Phone 7, I’m attempting to dynamically add controls to and object in

  • 0

With Windows Phone 7, I’m attempting to dynamically add controls to and object in codebehind, and apply a StaticResource to the new control.

Xaml file sample:

<phone:PhoneApplicationPage.Resources>
  <ControlTemplate x:Key="PushpinControlTemplateBlue" TargetType="my2:Pushpin">
  ...
  </ControlTemplate>
</phone:PhoneApplicationPage.Resources>

Codebehind sample:

>Pushpin myPush = new Pushpin();
>myPush.Location = new GeoCoordinate(52.569593, -0.9261151403188705);
>myPush.Content = "";
>myPush.Template = (ControlTemplate)Application.Current.Resources["PushpinControlTemplateBlue"];
>mapMain.Children.Add(myPush);

When I debug, and look at “Application.Current.Resources”, there are no items in the collection, so the item is added to the controls list, but doesn’t show up because it has no content.

Is there something simple I’m doing wrong? How do I correctly access the resource?

  • 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-05-19T02:12:25+00:00Added an answer on May 19, 2026 at 2:12 am

    If the resource is defined within the page you need to the resources in the page and any defined at applicaiton level.
    You can do this simply by refering to the Resources object within the page:

    this.Resources["PushpinControlTemplateBlue"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just got myself a new toy, a phone with Windows Mobile 6. I'm
I installed a new Windows Phone 7 template this week in Visual Studio, and
Exact Duplicate of: Getting the size (free,total) of a Windows Mobile phone drive using
I'm looking for small utility to run on windows mobile phone and trace all
I have played around with smart phone development (windows ce), and it seemed pretty
Say you have a Windows Mobile 6.0 phone that also has a GPS receiver.
Hey, im doing a little app for my smart phone, using Windows Mobile 6.
Windows phone asks for specific image sizes when submitting an application. When I take
Windows phone 7 standard pictures app has very nice flicking through images (choose concrete
Does Windows Phone 7 have anything like iPhone's UITableView? [Basically, I'm porting an iOS

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.