Live Chat Icon For mobile
Live Chat Icon

How can I set an attached property in code?

Platform: WPF| Category: Dependency Property

The following example shows how you can set an attached property in code.


DockPanel myDockPanel = new DockPanel(); 
CheckBox myCheckBox = new CheckBox(); 
myCheckBox.Content = 'Hello'; 
DockPanel.SetDock(myCheckBox, Dock.Top);  

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.