TileAdjustmentNeededAsync() protected method

Signal that an adjustment to the tiles is needed, then makes the call asynchronously. By asynchronously making this call, it can help prevent unnecessary work by the panel.
protected TileAdjustmentNeededAsync ( ) : void
return void
Example #1
0
        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();
            }
        }
Example #2
0
        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();
            }
        }