文章预览
今天再来分享一下IP输入框效果: 1、本想着偷懒拿来现成的直接用,参考如下 : https: //github.com/irihitech/Ursa.Avalonia 2、结果单独使用倒还是问题不大,结果放到DataGrid中,他的事件都失效了: 3、看了作者给的回复: Maybe we should set the event routing as tunnel. 4、算了还是自己基于 WPF效果第二百二十九篇之IP输入框 ,咱们自己耍耍吧: 5、OnApplyTemplate : protected override void OnApplyTemplate ( TemplateAppliedEventArgs e ) { base .OnApplyTemplate(e); FirstPartTxb = e.NameScope.Find (PART_FirstTextPresenter); SecondPartTxb = e.NameScope.Find (PART_SecondTextPresenter); ThirdPartTxb = e.NameScope.Find (PART_ThirdTextPresenter); FourthPartTxb = e.NameScope.Find (PART_FourthTextPresenter); AttachEvents(FirstPartTxb); AttachEvents(SecondPartTxb); AttachEvents(ThirdPartTxb); AttachEvents(FourthPartTxb); } 6、 监听TextInput和KeyDownEvent事件 private void
………………………………