Brian Kiarie Mwaniki
Brian Kiarie Mwaniki
CC#
Created by Mekasu0124 on 7/16/2024 in #help
How to use a templated control in main window view?
Hi @Mekasu0124, when using a templated control that is defined as a ResourceDictionary you need to include the resource itself in the main window view, like so: <Window> <Window.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceInclude Source="avares://LoudnessMeter.Views.TemplatedControls/LargeLabelControl.axaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> <Design.DataContext> <vm:MainWindowViewModel/> </Design.DataContext> <Grid> <Grid> <StackPanel> <controls:LargeLabelControl /> </StackPanel> </Grid> </Grid> </Window> I hope this helps
4 replies