silverlight: How to set attached properties Programmatically

后端 未结 3 2029
小鲜肉
小鲜肉 2021-02-05 05:58

Suppose I have a grid with some row definitions, and a child control in that grid. How would I go about setting the Grid.Row property of the child control programatically?

3条回答
  •  Happy的楠姐
    2021-02-05 06:22

    I'm not 100% sure this is in SilverLight, but in WPF you call a static method (called SetX, where X is the property) on the type the attached property is defined on and pass it in which control to set the value on, and the value:

    Grid.SetRow(MyControl, myRowNumber); 
    

提交回复
热议问题