路径转换

     前台代码

  xmlns:wpfApplication6="clr-namespace:WpfFormControl"

  <Button Content="{Binding Source={x:Static wpfApplication6:Title.aa},Converter={StaticResource ss}}"/>

后台

    /// <summary>
    /// Title.xaml 的交互逻辑
    /// </summary>
    public partial class Title : Window
    {
        public static string aa = "dfdf";

        public Title()
        {
            InitializeComponent();
            this.pswa.Content = Properties.Resources.psw;

        }
    }
    public class aConvert : IValueConverter
    {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return (string)value + ":d---fd";
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
View Code
原文地址:https://www.cnblogs.com/lizhenlin/p/5877955.html