MVVM, PropertyStatus, and CSLA 4 beta 3

MVVM, PropertyStatus, and CSLA 4 beta 3

Old forum URL:

Curelom posted on Tuesday, June 29, 2010

I'm delving into MVVM for the first time and I'm still shakey on a lot of the concepts.  My particular problem right now is that I can't get the PropertyStatus to work.

In my resources I have the following

        <this:SoxControlListViewModel x:Key="SoxControlListModel" />

        <DataTemplate x:Key="DataList">

         <Label Content="Control Activity Description:" Grid.Column="1" 
          HorizontalAlignment="Left" Margin="0" VerticalAlignment="Center" Grid.ColumnSpan="2" />
         <TextBox Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" 
          IsReadOnly="{Binding ElementName=ControlActivityDescriptionPS, Path=CanWrite, 
                       Text="{Binding Path=ControlActivityDescription, 
                              Mode=TwoWay, ValidatesOnExceptions=true, 
                       VerticalAlignment="Stretch" TextWrapping="Wrap"  IsReadOnlyCaretVisible="True" Margin="0" 
                       Grid.ColumnSpan="3" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch" />

                <csla:PropertyStatus Grid.Row="0" Grid.Column="1" 
                   Property="{Binding Path=ControlActivityDescription}" Margin="175,0,0,0" />

I've set my main DockPanel as bound to the model containing a buisness list object to a listbox
<DockPanel DataContext="{Binding Source={StaticResource SoxControlListModel}}">
<ListBox ItemsSource="{Binding Path=Model}"                     
      ItemTemplate="{StaticResource DataList}"
      csla:InvokeMethod.Target="{Binding Source={StaticResource SoxControlListModel}}"
      csla:InvokeMethod.MethodParameter="{Binding RelativeSource={RelativeSource Self}, 

When I run the window, it displays perfectly, however the propertystatus does not work.  I am able to break rules
without any error symbols and I'm able to edit the textbox when I shouldn't be able to.  Any pointers to get me headed in the right direction?

RockfordLhotka replied on Tuesday, June 29, 2010

There appears to be some bug (that I'm having a hard time finding - working on this today actually) with PropertyStatus in CSLA 4 beta 2 and beta 3. I'm seeing the same sort of issue you are encountering...

Curelom replied on Tuesday, June 29, 2010

I'm glad I'm not going crazy.  Good luck finding the bug.

RockfordLhotka replied on Tuesday, June 29, 2010

This was harder than I could have imagined, but the problem is solved.

There were two problems actually - the CanRead/CanWrite problem was trivial. The "disappearing control" problem was pretty crazy.

If you grab the latest code (PropertyStatus and Themes\Generic.xaml) from svn it should work - and of course the fix will be in the upcoming RC release.

Curelom replied on Tuesday, June 29, 2010

Will Do.

Thanks for the fix.  That was quite the bug.

Jaans replied on Tuesday, June 29, 2010

Any chance of this fix making its way into 3.8.4 Beta before it releases? (Pretty please)

I'm using 3.8.x in Silverlight 4 quite extensively.


RockfordLhotka replied on Tuesday, June 29, 2010

As I mentioned in the other thread - I might create a 3.9 that is 3.8.4 compiled for .NET 3.5 SP1 and SL4 in VS10. In that case I would fix this in that code.

But you can fix it yourself - now that we know the problem it is really trivial. Just do this:

  1. open themes\generic.xaml and change the visual state named "Valid" to "PropertyValid".
  2. open PropertyStatus.cs and replace all "Valid" state names with "PropertyValid" - there are 2-4 of them in the code


Copyright (c) Marimer LLC