C# 纯粹在xaml中连接文本和静态资源字符串
我试过这个:C# 纯粹在xaml中连接文本和静态资源字符串,c#,wpf,xaml,binding,C#,Wpf,Xaml,Binding,我试过这个: Sets literally Show {Binding Source={StaticResource AppInfoer}, Path=Title} <MenuItem Header="Show {Binding Source={StaticResource AppInfoer}, Path=Title}" Command="{StaticResource ShowWindowCommand}" CommandParameter="Open" /> set字面上显
Sets literally Show {Binding Source={StaticResource AppInfoer}, Path=Title}
<MenuItem Header="Show {Binding Source={StaticResource AppInfoer}, Path=Title}"
Command="{StaticResource ShowWindowCommand}" CommandParameter="Open" />
set字面上显示{Binding Source={StaticResource AppInfoer},Path=Title}
给定Header=“{Binding Source={StaticResource AppInfoer},Path=Title}”
很好地解析为“Main App”,我怎么能成功呢
- 在文字字符串“Show”前面加上前缀
- 从
{Binding Source={StaticResource AppInfoer},Path=Title}
谢谢,但当我在MenuItem头中复制你的代码时,它只显示“主应用程序”?i、 e.它不在“Show”前面。可能
MenuItem
或Header
不支持StringFormat
?最后,让它与替代实现一起工作内部类PrependConverter:IValueConverter{public object Convert(object value,System.Type targetType,object parameter,System.Globalization.CultureInfo culture){return string.Format(“Show{0}”,value);}/…}
和XAML
plus
{Binding Source={StaticResource AppInfoer}, Path=Title, StringFormat=Show {0}}