CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

BusinessBase.IsSave can not reflact enable property of Button in Silverlight

rated by 0 users
Answered (Not Verified) This post has 0 verified answers | 3 Replies | 2 Followers

Not Ranked
9 Posts
Marsh posted on Tue, Apr 17 2012 6:30 AM

I have ViewModel<T> business class and I have added Property of another businessclass to Validate search parameter. I have bound IsEnabled property of search button with businessclass object.IsValid Property.

But it does not get reflated when all required fields are selected.

Any Idea how to reflect UI with businessobject IsValid property

Does IsValid  is dependency property?

All Replies

Top 10 Contributor
9,270 Posts

That is correct. None of the metastate properties of business objects are bindable in the current versions of CSLA.

You should use ViewModelBase to access bindable versions of these properties, as shown in the video series and ebook series.

Rocky

Not Ranked
9 Posts
Marsh replied on Tue, Apr 17 2012 7:45 AM

Thanks for your replay.

I have created a dependency Property in ViewModel and added Event handler BrokenRulesCollection.CollectionChanged for businessbase object property. Then set dependency property in event by checking count of brokernRules and bind with IsEnable property of the search button 

 

 

if (this.Criteria.BrokenRulesCollection != null && this.Criteria.BrokenRulesCollection.Count != 0)

{

this.CanSearch = false;

}

else

{

this.CanSearch = true;

}

 

 

Its works fine.!!! But is it proper way achieve above scenario? 

Top 10 Contributor
9,270 Posts

You can look at the implementation of the various properties (like CanSave) in the ViewModelBase class in Csla.Xaml. There are some tricks to making these properties work correctly - and they don't need to be a DependencyProperty - just a bindable property that raises PropertyChanged.

Rocky

Page 1 of 1 (4 items) | RSS

Copyright (c) 2006-2010 Marimer LLC. All rights reserved.
Email admin@lhotka.net for support.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems