UWP: How to create and use custom control
Create a new project, Add a new item and then select user control
http://1.bp.blogspot.com/-lQwJ0hvNRE4/VloJzYJ_ObI/AAAAAAAAAPw/74MuU5dnKLo/s640/CustomControl.gif
Then go to MyUserControl1.xaml and add textblock and image from toolbox.
http://2.bp.blogspot.com/-N_k-kwU79Ec/VloJxO0FdkI/AAAAAAAAAPk/IZPyuOPPdsc/s640/CustomControl2.gif
Now we want to give the control to the user using our custom control so he/she can change text and image. For that go to MyUserControl1.xaml.cs and add a dependency property of type as of the 'text' property of textblock i.e string. In this case set metadata to 'null'.
http://4.bp.blogspot.com/-GDhD282O1Ss/VloJyWu-J5I/AAAAAAAAAPs/GV99GWUn1Cg/s640/CustomControl3.gif
Do the same for source of the image of the type 'ImageSource'
http://1.bp.blogspot.com/-4VR1iF7IarY/VloJ1jTG-gI/AAAAAAAAAP8/JlTewySzrWc/s640/CustomControl4.gif
Now bind the respected properties with our dependency properties so they can be changed by the user
http://2.bp.blogspot.com/-xtM-bWhkZ1U/VloJ6HCNsQI/AAAAAAAAAQM/5vn0u_ouUcg/s640/CustomControl6.gif
http://2.bp.blogspot.com/-GLVwwWfoJ9w/VloJ4F40C4I/AAAAAAAAAQA/T1LZKZUjauY/s640/CustomControl5.gif
Now we can use our created custom control anywhere we like. And can change the text or image source to add any image
http://3.bp.blogspot.com/-iEm0dx2LAAU/VloJ5zkirII/AAAAAAAAAQQ/LOW30wFF0W8/s640/CustomControl7.gif
Like this we can give the desired control over our custom control to the user by binding them with our created dependency properties.
Source Code: https://github.com/umerqureshi93/CustomControl
Create a new project, Add a new item and then select user control
http://1.bp.blogspot.com/-lQwJ0hvNRE4/VloJzYJ_ObI/AAAAAAAAAPw/74MuU5dnKLo/s640/CustomControl.gif
Then go to MyUserControl1.xaml and add textblock and image from toolbox.
http://2.bp.blogspot.com/-N_k-kwU79Ec/VloJxO0FdkI/AAAAAAAAAPk/IZPyuOPPdsc/s640/CustomControl2.gif
Now we want to give the control to the user using our custom control so he/she can change text and image. For that go to MyUserControl1.xaml.cs and add a dependency property of type as of the 'text' property of textblock i.e string. In this case set metadata to 'null'.
http://4.bp.blogspot.com/-GDhD282O1Ss/VloJyWu-J5I/AAAAAAAAAPs/GV99GWUn1Cg/s640/CustomControl3.gif
Do the same for source of the image of the type 'ImageSource'
http://1.bp.blogspot.com/-4VR1iF7IarY/VloJ1jTG-gI/AAAAAAAAAP8/JlTewySzrWc/s640/CustomControl4.gif
Now bind the respected properties with our dependency properties so they can be changed by the user
http://2.bp.blogspot.com/-xtM-bWhkZ1U/VloJ6HCNsQI/AAAAAAAAAQM/5vn0u_ouUcg/s640/CustomControl6.gif
http://2.bp.blogspot.com/-GLVwwWfoJ9w/VloJ4F40C4I/AAAAAAAAAQA/T1LZKZUjauY/s640/CustomControl5.gif
Now we can use our created custom control anywhere we like. And can change the text or image source to add any image
http://3.bp.blogspot.com/-iEm0dx2LAAU/VloJ5zkirII/AAAAAAAAAQQ/LOW30wFF0W8/s640/CustomControl7.gif
Like this we can give the desired control over our custom control to the user by binding them with our created dependency properties.
Create a new project, Add a new item and then select user control
http://1.bp.blogspot.com/-lQwJ0hvNRE4/VloJzYJ_ObI/AAAAAAAAAPw/74MuU5dnKLo/s640/CustomControl.gif
Then go to MyUserControl1.xaml and add textblock and image from toolbox.
http://2.bp.blogspot.com/-N_k-kwU79Ec/VloJxO0FdkI/AAAAAAAAAPk/IZPyuOPPdsc/s640/CustomControl2.gif
Now we want to give the control to the user using our custom control so he/she can change text and image. For that go to MyUserControl1.xaml.cs and add a dependency property of type as of the 'text' property of textblock i.e string. In this case set metadata to 'null'.
http://4.bp.blogspot.com/-GDhD282O1Ss/VloJyWu-J5I/AAAAAAAAAPs/GV99GWUn1Cg/s640/CustomControl3.gif
Do the same for source of the image of the type 'ImageSource'
http://1.bp.blogspot.com/-4VR1iF7IarY/VloJ1jTG-gI/AAAAAAAAAP8/JlTewySzrWc/s640/CustomControl4.gif
Now bind the respected properties with our dependency properties so they can be changed by the user
http://2.bp.blogspot.com/-xtM-bWhkZ1U/VloJ6HCNsQI/AAAAAAAAAQM/5vn0u_ouUcg/s640/CustomControl6.gif
http://2.bp.blogspot.com/-GLVwwWfoJ9w/VloJ4F40C4I/AAAAAAAAAQA/T1LZKZUjauY/s640/CustomControl5.gif
Now we can use our created custom control anywhere we like. And can change the text or image source to add any image
http://3.bp.blogspot.com/-iEm0dx2LAAU/VloJ5zkirII/AAAAAAAAAQQ/LOW30wFF0W8/s640/CustomControl7.gif
Like this we can give the desired control over our custom control to the user by binding them with our created dependency properties.
Create a new project, Add a new item and then select user control
http://1.bp.blogspot.com/-lQwJ0hvNRE4/VloJzYJ_ObI/AAAAAAAAAPw/74MuU5dnKLo/s640/CustomControl.gif
Then go to MyUserControl1.xaml and add textblock and image from toolbox.
http://2.bp.blogspot.com/-N_k-kwU79Ec/VloJxO0FdkI/AAAAAAAAAPk/IZPyuOPPdsc/s640/CustomControl2.gif
Now we want to give the control to the user using our custom control so he/she can change text and image. For that go to MyUserControl1.xaml.cs and add a dependency property of type as of the 'text' property of textblock i.e string. In this case set metadata to 'null'.
http://4.bp.blogspot.com/-GDhD282O1Ss/VloJyWu-J5I/AAAAAAAAAPs/GV99GWUn1Cg/s640/CustomControl3.gif
Do the same for source of the image of the type 'ImageSource'
http://1.bp.blogspot.com/-4VR1iF7IarY/VloJ1jTG-gI/AAAAAAAAAP8/JlTewySzrWc/s640/CustomControl4.gif
Now bind the respected properties with our dependency properties so they can be changed by the user
http://2.bp.blogspot.com/-xtM-bWhkZ1U/VloJ6HCNsQI/AAAAAAAAAQM/5vn0u_ouUcg/s640/CustomControl6.gif
http://2.bp.blogspot.com/-GLVwwWfoJ9w/VloJ4F40C4I/AAAAAAAAAQA/T1LZKZUjauY/s640/CustomControl5.gif
Now we can use our created custom control anywhere we like. And can change the text or image source to add any image
http://3.bp.blogspot.com/-iEm0dx2LAAU/VloJ5zkirII/AAAAAAAAAQQ/LOW30wFF0W8/s640/CustomControl7.gif
Like this we can give the desired control over our custom control to the user by binding them with our created dependency properties.