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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:38:50+00:00 2026-06-14T17:38:50+00:00

Hey guys i have this converter class : public class InboxItemValueConverters : IValueConverter {

  • 0

Hey guys i have this converter class :

public class InboxItemValueConverters : IValueConverter 
{
    public object Convert(object value, System.Type targetType,
                            object parameter, CultureInfo culture)
    {
        int urgency = (int)value;
        Brush brush = new SolidColorBrush();

        if (urgency == 0)
        {
            brush = new SolidColorBrush(Colors.Green);            }
        else if (urgency == 1)
        {
            brush = new SolidColorBrush(Colors.Yellow);
        }
        else if (urgency == 2)
        {
            brush = new SolidColorBrush(Colors.Red);
        }


        return brush;
    }

    public object ConvertBack(object value,  System.Type targetType,
                              object parameter,  CultureInfo culture)
    {
        return null;
    }



    public object ConvDateToShort(object value, System.Type targetType,
                            object parameter, CultureInfo culture)
    {
        DateTime DT = (DateTime)value;
        return DT.ToShortDateString();
    }


    public object Convdateback(object value, System.Type targetType,
                  object parameter, CultureInfo culture)
    {
        return null;
    }

}

and this is how i referenced it and used it the first time :

<src:InboxItemValueConverters x:Key="converttocolor" />

 <Canvas Background="{Binding Urgency, Converter={StaticResource converttocolor}}"

no in the class,as you guys can see i have a date converter in there? how would i go around getting to that object through the xaml? want to convert date in another control, from same class

new xaml :

Text="{Binding DocDate , Converter={StaticResource converttocolor}}"

thanks in advance!

i am using visual studio 2012/windows phone 8/c#/silverlight

  • 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-14T17:38:51+00:00Added an answer on June 14, 2026 at 5:38 pm

    You have to move your date converter out of the colorconverter class into it’s own class

    public class DateValueConverter : IValueConverter 
    {
        public object Convert(object value, System.Type targetType,
                                object parameter, CultureInfo culture)
        {
            DateTime DT = (DateTime)value;
            return DT.ToShortDateString();
        }
        public object ConvertBack(object value, System.Type targetType,
                      object parameter, CultureInfo culture)
        {
            return null;
        }
    }
    

    Then declare it at the top like you did your color converter and then change the converter to point to the date converter’s key

    //This needs to be declared below the colorconverter resource
    <src:DateValueConverter  x:Key="dateConverter" />
    
    Text="{Binding DocDate , Converter={StaticResource dateConverter}}"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys, I have this points system on a project, everything works fine except
Hey guys, I have this piece of jquery code: <script type=text/javascript > $(function() {
Hey guys, I have this code within a function inside a class that is
hey guys i have got this far with a chat system but now i
hey guys having this really simple problem but cant seem to figure out have
Hey guys I simply cannot get this to work. I have some content that
Hey guys, this is simple but I can't make it workn... blah! I have
Hey guys I have a object sitting in my tile map for spawn point
Hey guys, I have this quick bit of code that I can't figure out
Hey guys I have a weird error I wrote this code against setbubblepopup $(document).ready(function

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.