Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF: UI Converter using IValue Converter

$
0
0

Hi Guys, I need help with the IValue converter. Error Message: Invalid Resource Type & Expected type is IValueConverter

<Window.Resources><UI_Converters:DeviceStatusToTextConverter x:Key="statusConverter"/><UI_Converters:MediaTypeToTextConverter x:Key="mediaTypeConverter"/></Window.Resources>

XAML Property:

<TextBlock x:Name="tbStatusValue" TextWrapping="Wrap" Text="{Binding Status, Converter={StaticResource statusConverter}}" Grid.ColumnSpan="1" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left"/><TextBlock x:Name="tbMediaTypeValue" TextWrapping="Wrap" Text="{Binding PaperType, Converter={StaticResource mediaTypeConverter}}" Grid.ColumnSpan="1" Grid.Row="6" Grid.Column="1" HorizontalAlignment="Left"/>


I am  using the below conversion but still it's not working. Please help me to fix this problem. Thank you.

 [ValueConversion(typeof(int), typeof(String))]
        public class UIStatuses : IValueConverter
        {
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                UIStatuses status = (UIStatuses)value;
                return UIConverter.Instance.GetString("Status", status.ToString(), SupportedLangList.Instance.CurrentCulture);
            }

            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
            {
                
                return null;
            }
        }

Thank you very much


Viewing all articles
Browse latest Browse all 18858

Trending Articles