Click here to Skip to main content
15,888,157 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi,

I am trying to create a dependency property of type List<costumclass><t>>.
This is what I have written so far, but it is not working:

C#
public static readonly DependencyProperty ColumnsProperty = DependencyProperty.Register("Columns",
                                                                                                typeof (
                                                                                                    List<Column<string>>),
                                                                                                typeof (
                                                                                                    ReportBuilderView),
                                                                                                new PropertyMetadata(
                                                                                                    ColumnsChanged));


C#
public List<Column<string>> Columns
        {
            get
            {
                return (List<Column<string>>)this.GetValue(ColumnsProperty);
            }
            set
            {
                this.SetValue(ColumnsProperty, value);
            }
        }


C#
Binding myBinding3 = new Binding("Columns");
            myBinding3.Source = viewModel.Columns;
            myBinding3.Mode = BindingMode.TwoWay;
            BindingOperations.SetBinding(this, ReportBuilderView.ColumnsProperty, myBinding3);


for Columns in the viewModel is an
C#
ObservableCollection<column><string>></string></column>
Posted
Updated 27-Mar-11 5:53am
v4
Comments
Sergey Alexandrovich Kryukov 27-Mar-11 14:25pm    
What's "not working"? Look, there is no such thing for a developers as "not working". There are error messages, exceptions, issue reports...
--SA
Houssem K. 27-Mar-11 16:17pm    
The binding is not working when it is a collection, means no synchronization between the view and the view model. beside all works fine -means synchronized- when i change the type to string (simple one).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900