1
對於我一直在努力的項目,我將一些自定義控件從WPF平臺移植到UWP。 在WPF側它是作爲這樣實現的:無法從方法組轉換爲對象移植WFP => UWP
public static readonly DependencyProperty MaxLengthProperty = DependencyProperty.Register("MaxLength", typeof(int), typeof(HexBox), new PropertyMetadata(MaxLength_PropertyChanged));
public int MaxLength
{
get { return (int)GetValue(MaxLengthProperty); }
set { SetValue(MaxLengthProperty, value); }
}
private static void MaxLength_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
HexBox hexControl = (HexBox)d;
hexControl.txtValue.MaxLength = (int)e.NewValue;
}
與MaxLength_PropertyChanged
不帶參數被使用。 當我嘗試做UWP同我得到以下消息映入眼簾:
參數1:無法從「方法組」轉換爲「對象」
我知道這必須做沒有傳遞參數,或者用()作爲方法調用它們。但在WPF中這種行爲是隱含的。
任何人有想法?
這工作,感謝了一堆,原來你需要在UWP很多更詳細。 –