开发者

Bind ListView to list of numeric value types?

开发者 https://www.devze.com 2023-02-03 05:51 出处:网络
My googling is failing me this Monday morning.This should be simple, can someone help? Normally I bind ListView an object collection as in:

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

精彩评论

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