private static void ImagePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { // put code here to handle the property changed for Image TilePanel tilePanel = d as TilePanel; if (tilePanel != null) { Debug.WriteLine("ImagePropertyChanged"); tilePanel._imgBrush = e.NewValue as ImageBrush; // remove all of the existing tiles as they no longer are valid tilePanel.Children.Clear(); tilePanel.TileAdjustmentNeededAsync(); } }
private static void TileWidthPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { TilePanel tilePanel = d as TilePanel; if (tilePanel != null) { Debug.WriteLine("TileWidth Changed: {0}", e.NewValue); double val = (double)e.NewValue; if (val == double.NaN || val <= 0.0) { throw new ArgumentOutOfRangeException("TileWidth"); } tilePanel.TileAdjustmentNeededAsync(); } }