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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:43:36+00:00 2026-05-20T18:43:36+00:00

I have 2 collections I want to bind to a separate GridViewColumn in a

  • 0

I have 2 collections I want to bind to a separate GridViewColumn in a ListView:

public class EffectView : INotifyPropertyChanged
{

    ObservableCollection<Effect> effects;
    public ObservableCollection<Effect> Effects
    {
        get { return this.effects; }
        set
        {
            this.effects = value;
            this.RaisePropertyChanged ( "Effects" );
        }
    }

    ObservableCollection<EffectDescription> descriptions;
    public ObservableCollection<EffectDescription> Descriptions
    {
        get { return this.descriptions; }
        set
        {
            this.descriptions = value;
            this.RaisePropertyChanged ( "Descriptions" );
        }
    }
}

I can do this:

<ListView ItemsSource="{Binding EffectView.Effects}">
    <ListView.View>
        <GridView>
            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding Name}"
                            Header="Name" />

            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding Opacity}"
                            Header="Opacity" />

            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding ?}"
                            Header="Description" />
        </GridView>
    </ListView.View>
</ListView>

But then everything is scoped to EffectView.Effects, but I want the default scope to be EffectView so I can easily assign multiple collections to the ListView.

Something like:

<ListView ItemsSource="{Binding EffectView}">
    <ListView.View>
        <GridView>
            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding Effects Path=Name}"
                            Header="Name" />

            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding Effects Path=Opacity}"
                            Header="Opacity" />

            <GridViewColumn Width="Auto"
                            DisplayMemberBinding="{Binding Descriptions Path=Usage}"
                            Header="Description" />
        </GridView>
    </ListView.View>
</ListView>

Any way to accomplish this?

  • 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-20T18:43:36+00:00Added an answer on May 20, 2026 at 6:43 pm

    The ItemsSource of a ListView is the collection whose items will appear in the list. So think for a moment about what you’re asking the ListView to do:

    • As a source collection, use something that isn’t a collection, but contains them
    • For each row in the list, display an item from one collection, and an item from the other collection

    Pay attention to that second point: every row must display some item from the Events collection and some item from the Descriptions collection.

    Which item shall it pick from each? What’s the relationship between the items in the two collections?

    It appears that what you really need is a collection of objects that contains both an Event and a Description. You can then bind to that collection to display elements of both entities. Roughly, something like this:

    public class EffectView : INotifyPropertyChanged
    {
    
        ObservableCollection<EffectsAndDescriptions> effects;
        public ObservableCollection<EffectAndDescriptions> Effects
        {
            get { return this.effects; }
            set
            {
                this.effects = value;
                this.RaisePropertyChanged ( "EffectsAndDescriptions" );
            }
        }
    
    }
    
    internal class EffectsAndDescriptions
    {
        public Effect Effect { get; set; }
        public Description Description { get; set; }
    }
    

    Now you can bind to the EffectsAndDescriptions collection (note this assumes the DataContext of the ListView’s parent is EffectView)

    <ListView ItemsSource="{Binding EffectsAndDescriptions}">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="Auto"
                                DisplayMemberBinding="{Binding Effect.Name}"
                                Header="Name" />
    
                <GridViewColumn Width="Auto"
                                DisplayMemberBinding="{Binding Effect.Opacity}"
                                Header="Opacity" />
    
                <GridViewColumn Width="Auto"
                                DisplayMemberBinding="{Binding Description.Usage}"
                                Header="Description" />
            </GridView>
        </ListView.View>
    </ListView>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView and ObservableCollection in my wpf application. I want to bind
If i have a ListView (called MainList) and want to bind to elements in
I have class Person: public class Person : INotifyPropertyChanged { private String name =
I have an ObservableCollection that I want to bind to my listbox... lbRosterList.ItemsSource =
I need bind some ComboBoxes to one ObservableCollection. I have this ListView . <ListView
I have a collection ObservableCollection<Foo> , and I want to bind this to a
I have a an array of observable collections and I want to display all
I have a collection of objects I bind to a Listview like this: if
I have a view that creates and populates a Selectlist. I want to bind
I have a collection of objects that I wish to bind to a ListView

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.