无法在 UWP 应用程序中解析 System.Runtime 的范围
Unable to resolve scope of System.Runtime in UWP App
我正在构建一个 UWP 应用程序。我正在编写一个控件,使 Textbox
在单击之前看起来像一个文本块。所以,我从 Textbox
class 继承了我的 class 但我遇到了一些问题。这是我通过一些参考编写的代码。
public class EditableTextBox:TextBox
{
public EditableTextBox()
{
this.BorderBrush = new SolidColorBrush(Colors.Black);
}
protected override void OnTapped(TappedRoutedEventArgs e)
{
this.IsReadOnly = false;
SetEditingStyle();
base.OnTapped(e);
}
protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
{
this.IsReadOnly = false;
SetEditingStyle();
base.OnDoubleTapped(e);
}
protected override void OnLostFocus(RoutedEventArgs e)
{
this.IsReadOnly = true;
SetReadonlyStyle();
base.OnLostFocus(e);
}
public void SetReadonlyStyle()
{
this.BorderBrush.Opacity = 0;
this.Background.Opacity = 0;
}
public void SetEditingStyle()
{
this.BorderBrush.Opacity = 1;
this.Background.Opacity = 1;
}
}
编译器让我参考System.Runtime如下图:
The type 'Object' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Runtime, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Predefined type 'System.Void' is not defined or imported
The type 'Object' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Runtime, Version=0.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
我该怎么做才能解决这个问题?
右键单击解决方案资源管理器中的解决方案 window 和 select 'Restore NuGet packages for solution' 选项。
这将为您的项目下载所需的 NuGet 包。
我正在构建一个 UWP 应用程序。我正在编写一个控件,使 Textbox
在单击之前看起来像一个文本块。所以,我从 Textbox
class 继承了我的 class 但我遇到了一些问题。这是我通过一些参考编写的代码。
public class EditableTextBox:TextBox
{
public EditableTextBox()
{
this.BorderBrush = new SolidColorBrush(Colors.Black);
}
protected override void OnTapped(TappedRoutedEventArgs e)
{
this.IsReadOnly = false;
SetEditingStyle();
base.OnTapped(e);
}
protected override void OnDoubleTapped(DoubleTappedRoutedEventArgs e)
{
this.IsReadOnly = false;
SetEditingStyle();
base.OnDoubleTapped(e);
}
protected override void OnLostFocus(RoutedEventArgs e)
{
this.IsReadOnly = true;
SetReadonlyStyle();
base.OnLostFocus(e);
}
public void SetReadonlyStyle()
{
this.BorderBrush.Opacity = 0;
this.Background.Opacity = 0;
}
public void SetEditingStyle()
{
this.BorderBrush.Opacity = 1;
this.Background.Opacity = 1;
}
}
编译器让我参考System.Runtime如下图:
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Predefined type 'System.Void' is not defined or imported
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
我该怎么做才能解决这个问题?
右键单击解决方案资源管理器中的解决方案 window 和 select 'Restore NuGet packages for solution' 选项。
这将为您的项目下载所需的 NuGet 包。