private static void OnSelectedItemChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { CardPanel control = (CardPanel)o; if (e.NewValue == null) { return; } control.Zoom((FrameworkElement)control.objects[e.NewValue]); }
private static void OnItemsSourceChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { CardPanel control = (CardPanel)o; IEnumerable value = (IEnumerable)e.NewValue; //先用现有数据更新一次表头,当表头数据加载完成后,用新的表头数据再次更新表头 if (value != null) { control.UpdateItems(); if (value is INotifyCollectionChanged) { ((INotifyCollectionChanged)value).CollectionChanged += (o1, e1) => { control.UpdateItems(); }; } } }
private static void OnItemTemplateChanged(DependencyObject o, DependencyPropertyChangedEventArgs e) { CardPanel control = (CardPanel)o; control.UpdateItems(); }