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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T20:59:57+00:00 2026-06-10T20:59:57+00:00

I have a simple Observable collection with two public properties, int ID and List

  • 0

I have a simple Observable collection with two public properties, int ID and List Targets. The code-behind looks like (simplified code to remove unnecessary and not relevant code):

public class MyClass
{
   public ObservableCollection<SomeClass> jobs;

   public class SomeClass
   {
      private int id;
      private List<string> targets;

      public int ID
      {
         get { return id; }
         set { id = value; }
      }

      public List<string> Targets
      {
         get { return targets; }
         set { targets = value; }
      }

      public SomeClass(int _id, List<string> _targets)
      {
         id = _id;
         targets = _targets;
      }
   }

   public MyClass()
   {
      InitializeComponent();
      jobs = new ObservableCollection<SomeClass>();
      myListView.ItemsSource = jobs; //jobs is populated from a a loader in Window_Loaded
   }
}

The ListView and binding in the xaml look like:

  <ListView Name="MyListView" ItemsSource="{Binding Path=jobs, RelativeSource={RelativeSource AncestorType=Window},
            Mode=OneWay}" Width="480" Height="155" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,35,10,0" >
     <ListView.ContextMenu>
        <ContextMenu Name="contextMenuJobRemove">
           <ContextMenu.BitmapEffect>
              <OuterGlowBitmapEffect />
           </ContextMenu.BitmapEffect>
           <MenuItem Header="Remove" Click="contextMenuJobRemove_Click" CommandParameter="{Binding RelativeSource={RelativeSource Self}, Path=Parent}"/>
        </ContextMenu>
     </ListView.ContextMenu>
     <ListView.View>
        <GridView AllowsColumnReorder="True" ColumnHeaderToolTip="Broadcast call targets">
           <GridViewColumn DisplayMemberBinding="{Binding Path=ID}"   Header="ID"      Width="50" />
           <GridViewColumn DisplayMemberBinding="{Binding Path=Targets}" Header="Targets" Width="100" />
        </GridView>
     </ListView.View>
  </ListView>

So when the ListView displays, the Targets columns rightfully displays “(Collection)”. Ideally I’d like this column to display something like String.Join(",", Targets.ToArray()). How can this be done, and am I doing this in the xaml or code-behind?

  • 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-10T20:59:59+00:00Added an answer on June 10, 2026 at 8:59 pm

    One method would be a converter in the binding.

    However this will only update once the property is changed (not the collection contents). So it might be better to expose a display string property in your object and fire change notifications for that property whenever the list changes. If the collection does not change in the first place those notifications are obviously not necessary.

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

Sidebar

Related Questions

I have two simple Model classes and a ViewModel... public class GridItem { public
I have an observable collection bound to a listbox in WPF. One of the
Say I have a ListBox that is bound to an observable collection on my
in my Silverlight 4 project, I have a simple class implementing the interface like:
I have a simple collection bound to an observableArray that is initially empty. When
I have a listview control that is bound to an observable collection that I
I am implementing something like simple chat on silverlight. On my view I have
I have a simple Silverlight 5 datagrid bound to a ObservableCollection of objects: <sdk:DataGrid
Currently I have a simple knockoutJS object, with a few observables. But this object
I have simple table in Sybase -- Creating table 'SimpleText' CREATE TABLE [dbo].[SimpleText] (

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.