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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:46:37+00:00 2026-06-08T19:46:37+00:00

In my Windows Phone application I get the colour from xml and then bind

  • 0

In my Windows Phone application I get the colour from xml and then bind it to some element.
I have found that I get the wrong colour in my case.

Here is my code:

 var resources = feedsModule.getResources().getColorResource("HeaderColor") ??
     FeedHandler.GetInstance().MainApp.getResources().getColorResource("HeaderColor");
     if (resources != null)
     {
      var colourText = Color.FromArgb(255,Convert.ToByte(resources.getValue().Substring(1, 2), 16),
                       Convert.ToByte(resources.getValue().Substring(3, 2), 16),
                      Convert.ToByte(resources.getValue().Substring(5, 2), 16));

So after converting the colour, I get the wrong result. In xml I have this one:

 <Color name="HeaderColor">#FFc50000</Color>

and it converts into #FFFFC500

  • 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-06-08T19:46:39+00:00Added an answer on June 8, 2026 at 7:46 pm

    You should use some 3rd-party converter.

    Here is one of them.

    Then you can use it so:

    Color color = (Color)(new HexColor(resources.GetValue());
    

    Also you can use the method from this link, it works as well.

    public Color ConvertStringToColor(String hex)
    {
        //remove the # at the front
        hex = hex.Replace("#", "");
    
        byte a = 255;
        byte r = 255;
        byte g = 255;
        byte b = 255;
    
        int start = 0;
    
        //handle ARGB strings (8 characters long)
        if (hex.Length == 8)
        {
            a = byte.Parse(hex.Substring(0, 2), System.Globalization.NumberStyles.HexNumber);
            start = 2;
        }
    
        //convert RGB characters to bytes
        r = byte.Parse(hex.Substring(start, 2), System.Globalization.NumberStyles.HexNumber);
        g = byte.Parse(hex.Substring(start + 2, 2), System.Globalization.NumberStyles.HexNumber);
        b = byte.Parse(hex.Substring(start + 4, 2), System.Globalization.NumberStyles.HexNumber);
    
        return Color.FromArgb(a, r, g, b);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm busy working on a windows phone application that calls a servlet that then
I have to consume a feed XML (RSS) in my Windows Phone 7 application
In my Windows phone application I use RichTextBox element I have a hyperlink on
I'm trying to make a windows phone application that reads a json file from
I'm trying to send a very basic XML string from a Windows Phone application
I have to call a somewhat broken API from a Windows Phone 7 application.
I am having a problem with my Windows Phone application. When I get the
I am creating a windows phone application, which need to store some data in
I have a windows phone application and I need to add a user control
I am developing a Windows Phone Application and from this application I am accessing

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.