How do you pass parameters from xaml?

后端 未结 4 1455
我寻月下人不归
我寻月下人不归 2020-12-01 03:38

I have created my own UserControl \"ClockControl\", which I initialize through the main window\'s XAML.

The only problem is that I have to pass a parameter to the co

4条回答
  •  Happy的楠姐
    2020-12-01 04:25

    This is done with the use of DependencyProperty's, however not via the constructor. Just by adding properties to the control itself and using them from the code-behind.

    Have a read of the following in regards to DependencyProperty's:

    • Dependency Properties Overview
    • DependencyProperty Class MSDN
    • Why Dependency Properties?

    As a visual note, what this will allow you to do is the following, and then use it in the code-behind:

    
    

提交回复
热议问题