草庐IT

observe_field

全部标签

c# - 如何在 wpf ViewModel 中实现 observable int?

在我的mvvmViewModel中有这样的字段publicintDelta{get;privateset;}但是当我这样更新它时:Delta=newValue;UI未刷新。我在想数据绑定(bind)会为我做这件事。例如,我可以将集合声明为ObservableCollection,然后数据绑定(bind)将起作用。但是没有ObservableInt,怎么说View需要刷新呢?也许我应该提出一些事件“通知属性已更改”之类的? 最佳答案 你有两个选择:实现INotifyPropertyChanged类上的界面。继承自DependencyO

c# - C# : "An object reference is required for the non-static field, method, or property" 错误

我在WPF中编写代码。首先,我编写了一个单独的项目来测试COMport的工作。设备,并且运行良好。接下来我决定将它集成到另一个项目中,但我得到了一个错误。我没有更改代码;我只是将它复制到一个新的代码文件中。此代码运行良好:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usi

c# - C# : "An object reference is required for the non-static field, method, or property" 错误

我在WPF中编写代码。首先,我编写了一个单独的项目来测试COMport的工作。设备,并且运行良好。接下来我决定将它集成到另一个项目中,但我得到了一个错误。我没有更改代码;我只是将它复制到一个新的代码文件中。此代码运行良好:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Windows;usingSystem.Windows.Controls;usingSystem.Windows.Data;usingSystem.Windows.Documents;usi

Required field ‘client_protocol‘ is unset 原因探究

Requiredfield‘client_protocol’isunset!原因探究最新在做基于Thrift协议的hive客户端,但是遇到了Requiredfield'client_protocol'isunset!问题,具体一点的异常如下org.apache.thrift.TApplicationException:Requiredfield'client_protocol'isunset!Struct:TOpenSessionReq(client_protocol:null,configuration:{set:hiveconf:hive.server2.thrift.resultset.

c# - 可访问性不一致 : field type 'world' is less accessible than field 'frmSplashScreen

我有这个错误称为不一致的可访问性:fieldtype'world'islessaccessiblethanfield'frmSplashScreen'在我的代码中有一个名为frmSplashScreen的公共(public)部分类还有一个公共(public)类叫做world导致错误的行是:privateworldcurrentWorld;上面一行在类frmSplashScreen是什么导致了这个问题? 最佳答案 当你没有将类“world”初始化为public时也会发生这种情况你应该这样做:publicclassworld代替:cla

c# - 可访问性不一致 : field type 'world' is less accessible than field 'frmSplashScreen

我有这个错误称为不一致的可访问性:fieldtype'world'islessaccessiblethanfield'frmSplashScreen'在我的代码中有一个名为frmSplashScreen的公共(public)部分类还有一个公共(public)类叫做world导致错误的行是:privateworldcurrentWorld;上面一行在类frmSplashScreen是什么导致了这个问题? 最佳答案 当你没有将类“world”初始化为public时也会发生这种情况你应该这样做:publicclassworld代替:cla

小程序版vant field输入框批量双向绑定

在进行小程序开发时,我是使用HBuliderXuniapp+vue来进行小程序开发的在使用小程序版vant组件库输入框的时候发现他不能实现数据的双向绑定,这让我们很苦恼,这时我们可以使用一种方式来进行双向绑定我们可以使用change事件来实现数据监听1.声明一个对象,用来存储数据结果import{reactive}from"vue";constuser=reactive({ phone:'', code:''})2.定义输入框使用:value绑定数据,data-type的值和对象的属性一样,绑定@input事件van-fieldplaceholder="请输入手机号":value="user.

c# - ReSharper 7.1 "To Property with Backing Field"将字段移出位置

我最近升级到R#7.1,我遇到了这个问题,其中ToPropertyWithBackingFieldaction取代了我的支持字段并将它们移到类的顶部。例子:第1步:定义一个自动属性:publicclassMyClass{//...LotsofmembersherepublicintMyNewProperty{get;set;}//第2步:ReSharper的“ToPropertyWithBackingField”预期结果:publicclassMyClass{//...Lotsofmembershereprivateint_myNewProperty;//得到的结果:publiccla

c# - ReSharper 7.1 "To Property with Backing Field"将字段移出位置

我最近升级到R#7.1,我遇到了这个问题,其中ToPropertyWithBackingFieldaction取代了我的支持字段并将它们移到类的顶部。例子:第1步:定义一个自动属性:publicclassMyClass{//...LotsofmembersherepublicintMyNewProperty{get;set;}//第2步:ReSharper的“ToPropertyWithBackingField”预期结果:publicclassMyClass{//...Lotsofmembershereprivateint_myNewProperty;//得到的结果:publiccla

c# - 使用 TimeSpan 选择器的 Observable.Generate 似乎会泄漏内存 [当使用 TimeSpan > 15ms 时]

我正在研究Observable.Generate的使用,以使用msdn网站上的示例作为起点来创建按时间间隔采样的结果序列。以下没有TimeSpan选择器的代码不会出现内存泄漏:IObservableobs=Observable.Generate(initialState:1,condition:x=>xx+1,resultSelector:x=>x.ToString());obs.Subscribe(x=>Console.WriteLine(x));但是,以下带有TimeSpan选择器的代码会出现内存泄漏:TimeSpantimeSpan=TimeSpan.FromSeconds(1)