0
Reply

Auto Height Width Eror? Why?

Sascha B

Sascha B

Dec 2 2010 4:57 AM
10.7k
Hi,

I try to make a jump from WinForms to WPF so I'm really new in this area.
In WinForms I create buttons, textboxes with the code and also the positions.
Means: If the formsize change the button position chances as well.
But how is it in WPF?
I want to write something like this and get an error

 butsave[zaehler].Margin = new Thickness(newMeasure[aktTab].Width - butsave[zaehler].Width * 2 - 20, newMeasure[aktTab].Height - butsave[zaehler].Height - 10, 0, 0);

In WPF the Location has switched with Margin right?
So I tried it. But I got a debug error because the .Width and .Height from my TabItems("newmeasure") are auto values.
They are of course auto values because they have the size as the TabControl and the Tabcontrol has got just a margin (0,0,0,40) which sizes the Tabcontrol automatically.

So what is the advantige of using the auto scale trought margin but getting error if I want to point to its size?
Have I to write specific width and heigth and a resize method? Hope not...

Please let me know