Wpf IsValid

Wpf IsValid

Old forum URL: forums.lhotka.net/forums/t/5488.aspx


ajj3085 posted on Monday, September 29, 2008

Hi,

I'm looking at the ProjectTracker sample included with 3.5.1.  I see how the Save and Cancel buttons are enabled / disabled, but I have something a bit different.

I have an BusinessBase subclass, which is just a criteria class.. so I'm only using it to enforce rules so that a criteria can be made invalid if not specified correctly. 

I have the instance bound to a CslaDataProvider, and I'm just looking for a way to enable / disable the OK button based on the IsValid value.  I've tried binding to that property, but the button never enables.

Am I missing something?

Thanks
Andy

RockfordLhotka replied on Monday, September 29, 2008

The ObjectStatus control is the answer.

In 3.5.x I was using it as a container, but in 3.6 I'm using it as a resource, and that's a lot cleaner, so I recommend using the 3.6 approach.

In Silverlight we put the ObjectStatus properties directly into CslaDataProvider, and we may do that in .NET now too, as it is an even easier solution in some cases.

But look at the 3.6 ProjectTracker (C#) and examine how ObjectStatus is used - that'll work in 3.5 as well.

ajj3085 replied on Monday, September 29, 2008

It just started working for me for some reason... but I'll check out 3.6 code and update to that.

Copyright (c) Marimer LLC