I created class:
class StorageBase
{
public Queue<Slices> Slices {get;set;}
}
and wpf custom control which has dependency property Storage of type StorageBase:
public StorageBase Storage
{
get { return (StorageBase)GetValue(StorageProperty); }
set { SetValue(StorageProperty, value); }
}
public static readonly DependencyProperty StorageProperty =
DependencyProperty.Register("Storage", typeof(StorageBase), typeof(MaterialStreamControl), new UIPropertyMetadata(null, new PropertyChangedCallback(OnStoragePropertyChanged)));
static void OnStoragePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MaterialStreamControl).Render();
}
How could I rerender the component if slices in Storage changed?
Normally StorageBase would implement INotifyPropertyChanged. The setter on Slices would then raise the INotifyPropertyChanged.PropertyChanged event.
Example: http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.propertychanged.aspx
EDIT: You may also want to make Slices an ObservableCollection instead of a Queue.
http://msdn.microsoft.com/en-us/library/ms668604.aspx