开发者

Bind ListView to list of numeric value types?

My googling is failing me this Monday morning. This should be simple, can someone help?

Normally I bind ListView an object collection as in:

    <ListView Margin="5,10,5,10" x:Name="listViewFoo" ItemsSource="{Binding FooCollection}">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="50" Header="FooBar" DisplayMemberBinding="{Binding FooProperty}"/>
            </GridView>
        </ListView.View>
开发者_JS百科    </ListView>

How can I bind ItemsSource to a collection of say, System.Int64 objects and display them in one column?


You don't need DisplayMemberBinding; this should work...

    <ListView Margin="5,10,5,10" x:Name="listViewFoo" ItemsSource="{Binding FooCollection}">
        <ListView.View>
            <GridView>
                <GridViewColumn Width="50" Header="FooBar"/>
            </GridView>
        </ListView.View>
    </ListView>


Nevermind. Just deleted DisplayMemberBinding in the GridViewColumn.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜