How to access the elements of a ControlTemplate in Xamarin Forms

后端 未结 3 1474
温柔的废话
温柔的废话 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:17

    I havent found a way yet to iterate through the control template children. I used template binding https://developer.xamarin.com/guides/xamarin-forms/templates/control-templates/template-binding/ to bind to a command object, the properties for the commands are defined in my base page, then used a base view to define my commands and set them to the binding backing properties in the basepage OnAppearing override.

    I am working on a blog entry and will update this when I have code to show.

提交回复
热议问题