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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:16:51+00:00 2026-06-14T13:16:51+00:00

I have a listbox I’m trying to databind to with a metro app. Here

  • 0

I have a listbox I’m trying to databind to with a “metro” app. Here is my xaml:

    <ListBox x:Name="ImagesList" Margin="40" Grid.Row="1">
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Key}" />
            </StackPanel>
        </DataTemplate>
    </ListBox>

And I’ve created a source:

        List<KeyValuePair<string, string>> items = 
            new List<KeyValuePair<string, string>>();

        items.Add(new KeyValuePair<string, string>("a", "a"));
        items.Add(new KeyValuePair<string, string>("b", "b"));
        items.Add(new KeyValuePair<string, string>("c", "c"));
        this.ImagesList.ItemsSource = items;

I’d expect this to create a list of text in my app a, b and c

However instead I’m getting the following text for each element I’ve bound:

System.Runtime.InteropServices.CLRKeyBaluePairOmpl'2[System.String, System.String]

It looks like it’s displaying the fullname of the type I’m binding… what am I doing wrong?

  • 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-14T13:16:53+00:00Added an answer on June 14, 2026 at 1:16 pm

    You need to assign a Converter to the Binding.

    cerate converter as XAML resource

    <src:KeyValueConverter:Key="KeyConverter"/>
    

    Add binding converter to the text source

    Text="{Binding Path=ItemsList, Converter={StaticResource KeyConverter}}"
    

    sample converter code

    public class KeyValueConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var kvp = (KeyValuePair)value;
            return kvp.Key;
        }
    
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Listbox that is filled with 30,000 elements <ListBox Name=lbWordlist Grid.Row=1 Margin=10
I have this listbox : <ListBox x:Name=MyList ItemsSource={Binding ListOfBullets, Mode=TwoWay, Converter=StaticResourcedebugConverter}}> <ListBox.ItemTemplate> <DataTemplate> <local:TaskStepControl
I have listbox that displays information about list of objects: <ListBox Grid.Column=0 Height=152 Name=CustomersList
I have listbox in my wp7 app like this <ListBox Name=lstSelectedNumber Height=50 MaxHeight=120 VerticalAlignment=Top
I have Listbox: <ListBox x:Name=FriendsRequestList> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Horizontal> <StackPanel> <TextBlock Text={Binding FullName} Foreground=#FF316DCB/>
I have a listbox on a page: <select id=user_list name=user_list size=21 style=width:200px;> <option value=1>User
I have a listbox for a Windows Phone 7 app that displays info parsed
I have a ListBox defined in my app that I've populated with some static
I have a ListBox in my Windows Phone app, and I would like to
I have a ListBox control which is binded to a ObservableCollection . My XAML

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.