WrapDataGrid problem

Dec 9, 2010 at 12:23 PM

Hello, 

 I decided to try the MSCUI controls in my project. I made a very simple WPF application focused to WrapDataGrid control, but it does not work. What wrong?

 Data layer:

public class People

{

        public People(string name, string description)
        {
             Name = name;
             Description = description;
        }
        

        public string Name { get; set; }
        public string Description { get; set; }

        public override string ToString()
        {
            return String.Format("{0} - {1}", Name, Description);
        }

}

 

UI Layer:

 

<Window
    x:Class="UITester.Window1"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="462" Width="871"        
    xmlns:ctl="clr-namespace:Microsoft.Cui.Controls;assembly=Microsoft.Cui.WPFControls"
>

        <ctl:WrapDataGrid x:Name="WrapDataGrid" DataContext="{Binding}" Height="200">

        <ctl:WrapDataGrid.WrapDataGridColumns>            
                <ctl:WrapDataGridColumn >
                     <ctl:WrapDataGridColumn.CellTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{Binding Name}" Foreground="Black" />
                                    <TextBlock Text="{Binding Description}" Foreground="Black" />
                                </StackPanel>
                        </DataTemplate>
                   </ctl:WrapDataGridColumn.CellTemplate>
             </ctl:WrapDataGridColumn>
        </ctl:WrapDataGrid.WrapDataGridColumns>
    </ctl:WrapDataGrid>
    

</Window>

 

UI code behind:

public partial class Window1 : Window, IEnumerable
{
        List<People> peoples;

        public Window1()
        {
            InitializeComponent();            
            InitList();
            this.DataContext = this;        
        }
 
        private void InitList()
        {
            peoples = new List<People>();
            for (int i = 0; i < 10; i++)
            {
                People p = new People(String.Format("Name_{0}",i), String.Format("Description_{0}",i));
                peoples.Add(p);
            }
        }
 
        public IEnumerator GetEnumerator()
        {
            return peoples.GetEnumerator();
        }

    }

thanks for any advise 

fjosika