How to bind a dissertation

The following code example demonstrates how to bind a DataGridView control to a custom type by using a BindingSource component. When you run the example, you'll notice the DataGridView has labeled columns that reflect the properties of a Customer object, before the control is populated with data. The example has an Add Customer button to add data to the DataGridView control. When you click the button, a new Customer object is added to the BindingSource . In a real-world scenario, the data might be obtained by a call to a Web service or other data source.

Hi There,

I have a WPF ListView:

<UserControl
    x:Class="">
    <ListView IsSynchronizedWithCurrentItem="True" x:Name="MyListView">
        <>
            <GridView ColumnHeaderTemplate="{StaticResource DetailTemplate}">
                <GridViewColumn Header="First Name" 
                    Width="200"/>
                <GridViewColumn Header="Last Name"
                    Width="200"/>
            </GridView>
        </>
    </ListView>
</UserControl>


and a List in an object in the code-behind class:

namespace MyNamespace
{
    public class MyModel
    {
        List<CustomerName> customerList = new List<CustomerName>();

        public List<CustomerName> CustomerList
        {
            get { return ; }
        }
    }
}

namespace MyNamespace
{
    public class CustomerName
    {
        string FirstName { get; set; }
        string LastName { get; set; }
    }
}

namespace MyNamespace
{
    public partial class MyView : UserControl
    {
        private MyModel myModel;

        public MyView()
        {
            = new MyModel();
        }
    }
}

Now, I want to bind the CustomerList property of in MyView to MyListView. How to do it? I tried to do it via the DataContext and DisplayMemberBinding properties of the ListView, but couldn't get it to work.

Thanks,

Jay

How to bind a dissertation

how to bind a dissertation

Media:

how to bind a dissertationhow to bind a dissertationhow to bind a dissertationhow to bind a dissertation