Skip to content

Setting styles in templated control causes control to crash under windows #2316

Answered by MartinZikmund
kucint asked this question in Q&A
Discussion options

You must be logged in to vote

@kucint Apparently there is some limitiation in WinUI that requires controls to have default styles defined. To do so, you can create a XAML resource dictionary like:

<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="using:UnoAppTemplateBindingNotWorking.Controls">
    <Style TargetType="my:MyControl" />
</ResourceDictionary>

And then reference that dictionary in App.xaml:

<Application
    x:Class="UnoAppTemplateBindingNotWorking.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Application.…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kucint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants