views:

85

answers:

1

Hello!

Im usign a Ribbon Window and in the "content area beneath" I have a grid in which I will be displaying UserControls. To demonstrate my problem lets take a look at this simple UserControl:

        <ListView x:Name="lvPersonList">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="120" Header="Name" DisplayMemberBinding="{Binding Name}"/>
                <GridViewColumn Width="120" Header="Height" DisplayMemberBinding="{Binding Height}"/>
            </GridView>
        </ListView.View>
    </ListView>

And the code:

public partial class MyUserControl: UserControl
{
    private List<Person> personList;

    public TestSnpList()
    {
        InitializeComponent();
        this.personList = new List<Person>();
        this.personList.Add(new Person { Name = "Chuck Norris", Height = 210 });
        this.personList.Add(new Person { Name = "John Rambo", Height = 200 });
        this.lvPersonList.ItemsSource = personList;
    }
}
public class Person
{
    public string Name { get; set; }
    public int Height { get; set; }
}

The parent Window:

    <Grid x:Name="grdContent" DockPanel.Dock="Top">
        <controls:MyUserControl x:Name="myUserControl" Visibility="Visible"/>
    </Grid>

I don't understant why this binding doesn't work. Instead of values (Name and Height) I get full class names. If I use this code in a Window it works fine.

Any ideas? I would like this user contorl works for itself (it gets the data form the DB and represents it in a ListView)...

Thanks!

A: 

It seems the problem is with RibbonWindow. If I use Window and UserControl binding works fine, but if I use RibbonWindow (Odyssey Ribbon) binding doesn't work. What I don't understand is that in design mode I can see proper values and in running mode I see only class names:

http://i977.photobucket.com/albums/ae255/HekoSLO/designModeVSrunning.png

Heko