Bug 620 - Using RectangleF Offset on a Frame does not change the Frame value at all.
Summary: Using RectangleF Offset on a Frame does not change the Frame value at all.
Status: RESOLVED INVALID
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 4.x
Hardware: Macintosh Mac OS
: --- minor
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-03 17:15 UTC by Chris Hardy [MSFT]
Modified: 2011-09-05 16:47 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Comment 1 Sebastien Pouliot 2011-09-05 13:25:42 UTC
RectangleF is a struct (not a class, even less an NSObject), so you're not working with a reference to the GCRect but with a new (each time get_Frame is called) RectangleF instance. 

e.g. Object.ReferenceEquals (adView.Frame, adView.Frame) returns false,

Changing the value of the (local/managed/copied) Frame is never reflected anywhere (the original value is still used in ObjectiveC). You need to set a new RectangleF to get it copied over the native CGRect value.
Comment 2 Chris Hardy [MSFT] 2011-09-05 14:36:32 UTC
Shouldn't we have a bound CGRectOffset then rather than new-ing up a new RectangeF? Or doesn't it make a difference in the end?
Comment 3 Sebastien Pouliot 2011-09-05 16:47:47 UTC
> bound CGRectOffset...
> new-ing up a new RectangeF...

This is not* a binding issue but the way value-types (like structs) works.

Running:

	public RectangleF Rect { get; set; }

	static void Main ()
	{
		var p = new Program ();
		p.Rect = new RectangleF (10, 15, 20, 25);
		Console.WriteLine (p.Rect);
		// that would not even compile -> error CS1612: Cannot modify the return value of 'Program.Rect' because it is not a variable
		//p.Rect.X = 0;
		p.Rect.Inflate (new Size (1, 2));
		Console.WriteLine (p.Rect);
	}

will give:

{X=10,Y=15,Width=20,Height=25}
{X=10,Y=15,Width=20,Height=25}


* yep, we could use classes everywhere, but that brings other issues as well. That was a common question for System.Drawing.dll ;-)