C# WPF - GridLength GridUnitType.Auto -


can explain difference between using:

 gridlength length = new gridlength(0, gridunittype.auto)  

and

 gridlength length = new gridlength(1, gridunittype.auto) 

my limited knowledge of leads me believing these both identical solutions due auto being states..."auto", therefore making double value redundant.

most examples have seen show gridunittype.auto being preceded 1 rather 0, seems me either option works same?

is case or can shed light on if/how these different

i think understanding correct, when value gridunittype.auto used, first value passed constructor redundant, size determined content object.

it makes sense in context of gridlength structure constructor retain parameter (even though it's not used in instance), allows second parameter type contain values describe available states of gridunittype.

from documentation:

the enumerated type gridunittype can contain following values:

auto   - size determined size properties of content object.  pixel  - value expressed pixel.  star   - value expressed weighted proportion of available space.  

so really, first parameter relevant when second parameter set gridunittype.pixel or gridunittype.star.

it wouldn't work neatly other way around e.g. if tried have constructor accepted 1 parameter gridunittype, , required second parameter if used pixel or star.

this way round, benefit of having 1 parameter constructor accepts double without specifying additional type. although have cost of potentially odd looking 2 parameter constructor when using auto (as in example).


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -