Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomTemplateSelector not loading #27

Open
shandysawyer opened this issue May 22, 2022 · 1 comment
Open

CustomTemplateSelector not loading #27

shandysawyer opened this issue May 22, 2022 · 1 comment

Comments

@shandysawyer
Copy link

Having an issue getting the custom error message template to load. I am using the example you provided in your sample. The issue I am seeing is the object being passed is not a string but a NotificationContent object, so its skipping loading the template:
image

Is the sample old, or is this bug, or do I have my wiring wrong somewhere?

@shandysawyer shandysawyer changed the title CustomTemplateSelector CustomTemplateSelector not loading May 22, 2022
@Federerer
Copy link
Owner

It has been years since I used this last time, but IIRC you can define a template without overriding default template selector. Something like this:

    <Application.Resources>
        <Style TargetType="controls:Notification">
            <Style.Resources>
                <DataTemplate DataType="{x:Type local:YourModel}">
                    // Anything you want
                </DataTemplate>
            </Style.Resources>
        </Style>
    </Application.Resources>

I would probably use a dedicated class instead of trying to override the default template for NotificationContent because I don't see an easy way to override just error template without changing them all. I hope it helped 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants