Hello Tahmina,
When a component is inside a DataTemplate, it is no longer in the same scope of the page. This is why you can't just access it using an x:Name from the code behind.
The alternatives are:
Option 1
Use a shared event handler, maybe SizedChanged:
Option 2
Use x:Static and a static class property:
where the static class would be this:
You can update the static class property value from anywhere else in the app. For example when the page loads:
There are other more complicated ways, but those two are the least convoluted and give you easy option to change the value when you need to.
Regards,
Lance | Technical Support Engineer, Principal
Progress Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items