0
我有Binding
一個有趣的問題,我有一個DataTemplate
包含一個Button
和DataTemplate
已被放置在一個窗口(specView),我需要的Button.Command
到Commnad
綁定窗口的視圖模型裏面,所以我這樣做:如何將DataTemplate中的按鈕綁定到Window的Viewmodel命令?
Command="{Binding DataContext.NewOfferNoCommand,ElementName=specView}"/>
,但它並不會約束,直到我作出這樣的返回值轉換器:
public class ReturnValueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
}
我實在無法理解的問題是什麼任何IDIA?