Reputation: 8578
I'm trying set a margin of a Image Control top margin, I can get this value with Margin.Top
, but why can I set this with image1.Margin.Top = 5;
?
How to can I set just this only value?
Upvotes: 0
Views: 246
Reputation: 63481
This is because the property accessor does not give you a reference to the object. It is simply a wrapper around a DependencyProperty
, which returns the value via GetValue
. If you want to change that item, you must do this:
Thickness margin = image1.Margin;
margin.Top = 5;
image1.Margin = margin;
Upvotes: 3