English 中文(简体)
随着世界森林论坛的验证,我如何启动其他相互关联的要素,以重新检查其验证状况
原标题:With WPF validation, how do I trigger other interconnected ui elements to re-check their validation status

我拿到一只现场验证的验证工作罚款。 I ve got the DataAnnotations schools teed up to the IDataErrorInfo category so that they show appropriate.

现在,我发现一种更为复杂的形式,其验证更为复杂。 我在观察模式上实施了四甲苯胺,我认为这是所谓的。 我用人工叫Validator。 履历 无论何时发生外地变化,我都可以看到,IDataErrorInfo的班级有适当的回报错误。

我的问题是,我不知道如何让国际律师团重新检查它是否具有验证地位。 例如,只有D具有一定价值时,我才发现A、B和C等地。 因此,这些领域没有数据年度旗帜——我只是回去了在ValidatableObject执行过程中的错误清单。

现在,当我编辑D时,A、B或C没有出现任何错误。 如果我在A中看到一些错误,那么A就会出现错误。 但我希望所有领域都自动这样做。 这样做是否有正常办法,特别是要从《观点》中引起?

最佳回答

我有同样的问题,而后又将其张贴在https://stackoverflow.com/q/7121867/302677>以下。

我最后做的是建立一种延伸方法,留待<代码>PropertyChanging活动,并在具体规定的<代码>ValidationGroup内提高任何财产的验证错误。

这里使用的是:

public MyViewModel()
{
    this.AddValidationGroup(
        new List<string> { "A", "B", "C", "D" },
        GetValidationError, OnPropertyChanged);
}

下面是您的班级需要执行<条码> 指定使用。 (我使用实体框架,各实体自动实施这一接口)

这里还有另一个答案,它没有使用<代码>PropertyChanging活动,并且可以帮助你。

当然,总是在贵方相关财产的固定方法中找到简单提升<>关于不动产的编码>;。

public string A
{
    get { return _a; }
    set
    {
        _a = value;
        RaisePropertyChanged("A");
        RaisePropertyChanged("B");
        RaisePropertyChanged("C");
        RaisePropertyChanged("D");
    }
}
问题回答

暂无回答




相关问题
WPF convert 2d mouse click into 3d space

I have several geometry meshes in my Viewport3D, these have bounds of (w:1800, h:500, d:25). When a user clicks in the middle of the mesh, I want the Point3D of (900, 500, 25)... How can I achieve ...

Editing a xaml icons or images

Is it possible to edit a xaml icons or images in the expression design or using other tools? Is it possible to import a xaml images (that e.g you have exported) in the expression designer for editing?...

WPF: writing smoke tests using ViewModels

I am considering to write smoke tests for our WPF application. The question that I am faced is: should we use UI automation( or some other technology that creates a UI script), or is it good enough to ...

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

How do WPF Markup Extensions raise compile errors?

Certain markup extensions raise compile errors. For example StaticExtension (x:Static) raises a compile error if the referenced class cannot be found. Anyone know the mechanism for this? Is it baked ...

WPF design-time context menu

I am trying to create a custom wpf control, I m wondering how I can add some design-time features. I ve googled and can t seem to get to my goal. So here s my simple question, how can I add an entry ...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签