ListView GridView处理ColumnsReorder [英] ListView GridView Handle ColumnsReorder

查看:499
本文介绍了ListView GridView处理ColumnsReorder的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理/坚持列重新排序?不需要改变它。需要坚持下去,所以当用户再次调用GridView时,可以显示上次定义的列。

How to handle/persists columns reorder? Don't need to change it. Need to persist it so when the user brings up the GridView again can present the columns in order they last defined.

 <ListView>
        <ListView.View>
            <GridView AllowsColumnReorder="True" >


推荐答案

不幸的是,您不会找到StoreColumnOrder = 真设置。你将不得不自己编码。并坚持下来,你必须将订单存储在磁盘上的某个地方,比如设置文件。

Unfortunately, you are not going to find a StoreColumnOrder="True" setting. You will have to code this up yourself. And to persist you have to store the order somewhere on disk, like a settings file.

创建一个从GridView继承的新对象(或者可以创建一个UserControl作为),它为onloaded事件添加一个函数,并在onclose事件中添加一个函数。 onloaded函数将查找设置文件,如果它在那里,请重新排序列。如果发生重新排序,onclose函数会创建设置文件。

Create a new object that inherits from your GridView (or you could create a UserControl as well) that adds one function to the onloaded event and one function to the onclose event. The onloaded function would look for a settings file and if it was there, reorder the columns. The onclose function createst the settings file if reordering has occurred.

这篇关于ListView GridView处理ColumnsReorder的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆