ListView GridView处理ColumnsReorder [英] ListView GridView Handle 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屋!