protected virtual void OnWindowSizeChanged( object sender, EventArgs e )
{
if( Dispatcher.CurrentDispatcher != Application.Current.Dispatcher ) throw new InvalidOperationException( "This method should only be called by the Application Thread." );
IWindowElement windowElementFromSender = sender as IWindowElement;
if( windowElementFromSender != null )
{
WindowElementData data = null;
if( _dic.TryGetValue( windowElementFromSender, out data ) )
{
double previousWidth = data.Width;
double previousHeight = data.Height;
data.UpdateFromWindow();
double deltaWidth = data.Width - previousWidth;
double deltaHeight = data.Height - previousHeight;
if( deltaWidth != 0 || deltaHeight != 0 )
{
var evt = new WindowElementResizeEventArgs( windowElementFromSender, deltaWidth, deltaHeight );
if( WindowResized != null )
WindowResized( sender, evt );
}
}
}
}