프로그래밍/xamarin

xamarin 강좌 020. Custom Native Control 만들기(4) - Native Control의 event를 xaml 파일까지 넘기기

panpro 2021. 1. 10. 16:27

xamarin 20번째,

xamarin에서 Custom Native Control 만들기 4번째 시간으로,

 

native control에서 발생시킨 event를 renderer가 받고, 그걸 다시 view가 받고, 그 이벤트를 다시 xaml 파일에서 쓸 수 있도록 하는 과정을 설명합니다.

 

여기까지 하시면 우리가 원했던, xaml 파일에서 native control에 속성값을 전달하고, native control에서 발생한 event를 .xaml.cs 파일에서 처리할 수 있게 됩니다.

 

그래서 드디어 우리가 만든 콘트롤을

 

<local:MyView ButtonText="버튼테스트" OnButtonClicked="clicked">

 

와 같은 식으로 xaml 파일에서 사용할 수 있게 됩니다.

 

관련 강의: youtu.be/3Ahb92W7jRE