How to access the elements of a ControlTemplate in Xamarin Forms

后端 未结 3 1494
温柔的废话
温柔的废话 2021-01-12 13:58

I have a ControlTemplate defined in App.xaml. Now, I need to be able to handle certain UI events. In Visual Studio\'s XAML editor, if I attach a handler to an event, the han

3条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-12 14:11

    Although this is a old topic but the actual Xamarin Forms API provides the following and works out of the box:

    contentView.GetTemplateChild("nameOfTheControl")
    

提交回复
热议问题