C
C#2mo ago
Core Dream

WPF Resource Issue

Hello all. I am having a weird issue or I'm overlooking something in WPF. This is my code: App.xaml
<Application x:Class="TitanSTUDIO.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TitanSTUDIO.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/GenericTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
<Application x:Class="TitanSTUDIO.App.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:TitanSTUDIO.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Themes/GenericTheme.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
GenericTheme.xaml
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:TitanSTUDIO.App">

<Style x:Key="HeaderTitle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#ffffff" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Margin" Value="40 30 0 15" />
</Style>
</ResourceDictionary>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:custom="clr-namespace:TitanSTUDIO.App">

<Style x:Key="HeaderTitle" TargetType="TextBlock">
<Setter Property="Foreground" Value="#ffffff" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Margin" Value="40 30 0 15" />
</Style>
</ResourceDictionary>
Screenshot of it in use is posted due to Discord message limit. Thank you.
No description
No description
1 Reply
BluDay
BluDay2mo ago
Where does GenericTheme.xaml exist in your project directory? Does it really exist in the {ProjectRoot}/Themes/ directory? If {ProjectRoot}/Themes/GenericTheme.xaml exists, you could try to prepend the pack URI scheme to the source URI. <ResourceDictionary Source="pack://application:,,,/Themes/Generic.xaml"/>
Want results from more Discord servers?
Add your server