I'm attempting a little learning project and was wondering if I could get some help on the following:
var newimg = new BitmapImage(); newimg.BeginInit(); newimg.UriSource = new Uri("Images\\Snoop.gif", UriKind.Relative); newimg.EndInit(); ImageBehavior.SetAnimatedSource(img, newimg); MainWin.Width = img resized width; <----- SizeChanged += (o, e) => { var r = SystemParameters.WorkArea; Left = r.Right - ActualWidth; Top = r.Bottom - ActualHeight; };
var newimg = new BitmapImage(); newimg.BeginInit(); newimg.UriSource = new Uri("Images\\Snoop.gif", UriKind.Relative); newimg.EndInit(); ImageBehavior.SetAnimatedSource(img, newimg); MainWin.Width = img resized width; <----- SizeChanged += (o, e) => { var r = SystemParameters.WorkArea; Left = r.Right - ActualWidth; Top = r.Bottom - ActualHeight; };
How can I get the automatically resized width of the new img? My current main window has a capped height of 300. The width is auto and the img has an auto height and width so it scales to the 300 pixel height. If I manually change the main window width size everything works perfectly fine.