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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:25:23+00:00 2026-05-15T05:25:23+00:00

I think the easiest way to explain this is by example. I have a

  • 0

I think the easiest way to explain this is by example.

I have a Datagrid with a data context of a list of People Objects:

People{
string Name;
int AstroSignCode;
}

I am using a code to store the astro sign because the values will be persisted in a database. I cant just use the astrology Object.

Then I have a Text Column which binds to this object and uses a converter which returns an AstrologySign Object from a static list of signs based on a cross reference between AstrologySign.ID and People.AstroSignCode:

AstrologySign{
string Name;
DateTime StartDate;
DateTime EndDate;
int ID;
}

So my converter is returning an Object instead of something displayable.

How do I bind the Column to the Member of the object returned from the converter?

my Xaml so far for the column is this:

I think that I might need to use a DataGridTemplateColumn but I’m not sure anymore.

  • 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-15T05:25:24+00:00Added an answer on May 15, 2026 at 5:25 am

    I answered my own question. it took some time to figure this out because to me, it was not obvious.

    I did infact need to use a DataGridTemplateColumn instead of a DataGridTextColumn.

    <sdk:DataGridTemplateColumn Header="Astro Sign">
                    <sdk:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock DataContext="{Binding AstroSign, Converter={StaticResource AstrologySignConverter}}" Text="{Binding Name}"/>
                        </DataTemplate>
                    </sdk:DataGridTemplateColumn.CellTemplate>
                </sdk:DataGridTemplateColumn>
    

    What is happening here is the data context of the DataGrid is a list of People. Each Person has an astrosigncode which is an integer. This gets mapped by the AstrologySignConverter to an AstrologySign object which Contains the name. so I make a datatemplate and use the TextBlock control and i set it’s context to a binding using the converter then i bind to the element of the object that the converter returns.

    It’s simple once you see that you can do it. Thanks anybody who tried to solve this!

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

Sidebar

Related Questions

The easiest way to think of my question is to think of a single,
I think most people know how to do this via the GUI (right click
I'm messing with a simple authorization scheme. I think the easiest way to do
i have the following structure... $output = '<li><a href=http://forum.example.org>Something</a></li>' Actually $output holds multiple list-items.
I think most people here understand the importance of fully automated builds. The problem
I think this is specific to IE 6.0 but... In JavaScript I add a
I think I know how to handle this case, but I just want to
I would like to know the easiest way to draw a straight line between
I'm pretty sure this particular quirk isn't a duplicate so here goes. I have
I figured the easiest thing to do was to just change the port number

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.