回复 15楼bj_zm的帖子
请替代demo中的以下代码:
- void c1olappanel1_Loaded(object sender, RoutedEventArgs e)
- {
- // force control to apply template if it hasn't already
- c1olappanel1.ApplyTemplate();
- ListBox fieldsBox = FindListBox(c1olappanel1, "Fields"); // Fields is the name of the ListBox
- // get items from list box
- //IEnumerable<C1OlapField> fields = fieldsBox.Items.Cast<C1OlapField>();
- C1OlapFieldList fields = (C1OlapFieldList)fieldsBox.ItemsSource;
- // had trouble casting result of LINQ to C1OlapFieldList
- //fieldsBox.ItemsSource = fields.OrderByDescending(f => f.Name).Cast<C1OlapFieldList>();
- // move last item to front
- C1OlapField lastItem = fields[3];
- fields.RemoveAt(3);
- fields.Insert(0, lastItem);
- fieldsBox.ItemsSource = fields;
- }
复制代码 |