i have some xml code who add a ScaleX of 1 to one of my grid.
Looks like :
<Grid.RenderTransform>
<ScaleTransform x:Name="player1Scale" ScaleX="1" />
</Grid.RenderTransform>
It works nice. But now I need to apply a ScaleX of 1 to another grid but with C# code. So i did something like that:
ScaleTransform myScaleTransform = new ScaleTransform();
myScaleTransform.ScaleY = 0;
myScaleTransform.ScaleX = 1;
TransformGroup myTransformGroup = new TransformGroup();
myTransformGroup.Children.Add(myScaleTransform);
grid.RenderTransform = myTransformGroup;
and i get an error with no details. Only
An unhandled exception of type 'System.FormatException' occurred in mscorlib.dll
So i did some researchs and i didnt find whats wrong with my code >< ?
Without this part of code my grid is fine. But as soon I put this ScaleTransform the grid disapears and I get this single line of error.
I always tried to do
grid.RenderTransform = new ScaleTransform(1, 0);
grid.RenderTransform = new ScaleTransform(1.0d, 0.0d);
grid.RenderTransform = new ScaleTransform(Convert.ToDouble("1"), Convert.ToDouble("0"));
and so many others things that didnt work... So now I need to ask here how can I solve this problem..
I hope somebody can find the answer, I can give you more details if needed.
Thx to read me.