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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:23:02+00:00 2026-05-28T03:23:02+00:00

I was wondering how to retrieve a particular setter from a style object in

  • 0

I was wondering how to retrieve a particular setter from a style object in code-behind in silverlight.

I have a style S which is correctly loaded and applied to some object. Then during runtime i want to alter one particular setter of this style say its Background setter (Of course what i want is to alter the value of one particular setter).

To do so i looked at the Setters collection which is of type SetterBaseCollection and contains all setters of this style. So far so good. This collection seems to include all setters as they are defined in XAML but how to do i get access to them ?

When i iterate over this collection i am dealing with objects of type “Setter”. But I don’t know how to pick the one which contains the “Background” property.

// this works totally fine; the variable myStyle is getting the correct Style
myStyle = this.Resources["myStyle"] as Style;

// the myStyle.Setters collection seems to contain all setters of the style
foreach (Setter s in myStyle.Setters) {

   // so now what to do to get the setter that sets the Background property of my style ??

  // my naive approach did not work:
  if (s.Property.ToString().equals("Background")) {

      // do something
  }
}

(The Setter objects does have a Name attribute, which in fact is exactly what I want to accomplish a comparison with the string “Background” – and debugging offered that this attribute truly contains the string “Background”. … But it’s a non-public attribute!

It would be great if anyone would have any suggestions 🙂

p.s. My local time is 03:00 AM so i am a bit tired and overworked – so please ask me to clarify my issue again in case you have troubles guessing what i need 😉

  • 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-28T03:23:03+00:00Added an answer on May 28, 2026 at 3:23 am

    Setters in a style get sealed anyway (probably along with the containing collection once the style is in use) so you cannot modify it, styles are meant to be persistent. I would recommend you swap out the whole style with a new one or try to approach this differently.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am wondering which is a more efficent method to retrieve data from the
I was wondering if we retrieve a dataset in C# from SQL database .then
I want to retrieve the most recently added record from CoreData. I was wondering
hey, I'm wondering how to retrieve data from my database using php to get
I'm just wondering if it's possible to retrieve the the most entered entries from
I was wondering what the best approach is on Android to retrieve information from
I was wondering if there is a way to retrieve the MySQL code for
just wondering if how can we retrieve a data from stored procedure, who's return
I have a situation where I must use Windows API to retrieve text from
i have a php code here and wondering how can this display what you

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.