danrer
Topic Author
Posts: 10
Joined: 27 Apr 2019, 18:20

RenderTransform

18 Apr 2020, 21:10

I need to do moving elements inside the Grid, in c# I use RenderTransform, but when I try to use it in c++ I get an error: "Cannot set 'Matrix' property on object 'MatrixTransform' because it is in a read-only state";
void TestNoesis::MoveButton_PreviewMouseMove(Noesis::BaseComponent* sender, const Noesis::MouseEventArgs& e)
{
	Grid* rootGrid = (Grid*)this->GetParent();

	MatrixTransform* transform = (MatrixTransform*)this->GetRenderTransform();
	Transform2f mtx = transform->GetMatrix();

	float x = 0;
	float y = 0;

	mtx.Translate(x, y);
	transform->SetMatrix(mtx);
	this->SetRenderTransform(transform);
}

Tags:
 
danrer
Topic Author
Posts: 10
Joined: 27 Apr 2019, 18:20

Re: RenderTransform

19 Apr 2020, 18:14

I should have added
	  <Grid.RenderTransform>
		<TranslateTransform />
	  </Grid.RenderTransform>
 
User avatar
sfernandez
Site Admin
Posts: 1912
Joined: 22 Dec 2011, 19:20

Re: RenderTransform

21 Apr 2020, 17:34

Yes, the default value for RenderTransform property is the Identity transform, that is a frozen MatrixTransform.
So if you want to change it you should provide the appropriate transform type as you found.

Marking this as solved.

Who is online

Users browsing this forum: Google [Bot] and 1 guest