C
C#2y ago
Elio

❔ ResourceDisctionary With Converter

Hello, i do not understand why my converter imageResourceConverter isn't found when i start my application any idea ? The error : Exception: Could not find resource named "imageResourceConverter". Resource names are case sensitive.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style x:Key="CircularButtonStyle" TargetType="Button">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse Fill="Transparent"/>
<Image Source="{Binding Tag, Converter={StaticResource imageResourceConverter}}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

<Style x:Key="CircularButtonStyle" TargetType="Button">
<Setter Property="Width" Value="50"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<Ellipse Fill="Transparent"/>
<Image Source="{Binding Tag, Converter={StaticResource imageResourceConverter}}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</ResourceDictionary>
<Application x:Class="EasyrollV5.WPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EasyrollV5.WPF"
xmlns:converter="clr-namespace:EasyrollV5.WPF.Converters" >

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/ButtonStyle.xaml"/>
<ResourceDictionary Source="Resources/DesignDictonary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<converter:ImageResourceConverter x:Key="imageResourceConverter"/>
</ResourceDictionary>
</Application.Resources>
</Application>
<Application x:Class="EasyrollV5.WPF.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:EasyrollV5.WPF"
xmlns:converter="clr-namespace:EasyrollV5.WPF.Converters" >

<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/Styles/ButtonStyle.xaml"/>
<ResourceDictionary Source="Resources/DesignDictonary.xaml"/>
</ResourceDictionary.MergedDictionaries>
<converter:ImageResourceConverter x:Key="imageResourceConverter"/>
</ResourceDictionary>
</Application.Resources>
</Application>
2 Replies
JakenVeina
JakenVeina2y ago
hmmm looks right to me start challenging your basic assumptions is this code actually the code that's being built? or run?
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server