Error "The calling thread cannot access this object because a different
thread owns it" when set a margin to table
I try set Margin for Table in code behind but can't, just have exception:
"The calling thread cannot access this object because a different thread
owns it." My code:
Table table = new Table();
Image picture = GetPicture(pictureName);
double leftMargin = (MAX_PICTURE_WIDTH - picture.Width) <= 0 ? 0 :
(MAX_PICTURE_WIDTH - picture.Width);
table.Margin = new Thickness(leftMargin, 0, 0, 0);
In last row when set a margin I have exception. So why? How solve this
problem?
No comments:
Post a Comment