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

  • SEARCH
  • Home
  • 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 have a windows phone application and I need to add a user control
Windows Phone 7.1: How to add/delete items from LongListSelector control? I am using a
Windows Phone 7.5 app. Designer has created Home.xaml in Blend that has 3 images(menu
In windows phone app i use SmsComposeTask to send sms: SmsComposeTask sms = new
In Windows Phone (mango) I am using Microsoft.Phone.Controls.Maps. I currently have: var _City =
Some controls in Windows Phone 7 have touchable area around, if you touch not
I am new in windows phone development. Now I am developing a windows phone
In Windows Phone I populate my Pivot control with an ObservableCollection model that gets
On Windows Phone 7, go to Settings, email & accounts, add an account, the
Windows phone performance analysis creates a file with .sap extension. This .sap file is

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.