最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

visual studio 2022 - Can't make UWP Templated Control - Stack Overflow

programmeradmin3浏览0评论

I really want a Templated Control in my UWP app. Just like Custom Control in WPF, not User Control. But I can't make it work with Visual Studio 2022. When I add a new Templated Control to the MainPage - app throws an exception saying

Specified cast is not valid

Can reproduce it very quickly:

  1. Create a new UWP project
  2. Add a new Templated Control - MyControl.cs. That creates a control with minimal code/XAML that should suffice
  3. In the MainPage, add <local:MyControl/> to the root grid
  4. Run the app - it fails, saying 'Specified cast is not valid'

How can I fix that?

发布评论

评论列表(0)

  1. 暂无评论