I have read this SOF Post: How to properly reference a class from XAML But i cannot get this work. Because my converter class is subclass, i cannot get reference on XAML.
The Converter Class:
using System;
using System.Windows;
using System.Windows.Data;
namespace GapView.Classes
{
public class ConverterClass
{
public class PhotoBorderConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
int width = System.Convert.ToInt32(value);
return width + 16;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
int width = System.Convert.ToInt32(value);
return width - 16;
}
}
}
}
And the MainWindow.xaml, XML section, i add
xmlns:GapView="clr-namespace:GapView"
xmlns:Classes="clr-namespace:GapView.Classes"
Inside
<Classes:ConverterClass x:Key="BorderConverter" />
Finally, i apply to Border element. And SettingThumbWidth is a TextBox element.
<Border Width="{Binding Path=Text , ElementName=SettingThumbWidth, Converter={StaticResource BorderConverter}}" Height="166" >
When i press "." after BorderConverter, the subclass PhotoBorderConverter won't show and it seems i cannot access.
So how can i fix this?
It because it possible have other Converter, so i want to centralized in one ConvertClass.
Thanks you.