Silverlight 3 CheckBox with Csla 3.8.2b

Silverlight 3 CheckBox with Csla 3.8.2b

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


FoodmanCyclingPA posted on Thursday, January 07, 2010

I am having a devil of a time getting my CheckBox to bind correctly to the object.  I was able to get CheckBoxes to bind to an EditableRootListBase object collection with a BusinessBase in the collection, but I am having a devil of a time getting it to bind to just a businessbase.  Here is the code that I have:

    <TextBlock x:Name="IsNYMEXHoliday"
        Grid.Column="0" Grid.Row="4"
        Text="NYMEX Holiday"/>
    <CheckBox x:Name="IsNYMEXHolidayCheckBox"
              Grid.Column="1" Grid.Row="4"
              IsChecked="{Binding Path=IsNYMEXHoliday, Mode=TwoWay}"
              IsThreeState="False"
              IsEnabled="True" />
   <csla:PropertyStatus Grid.Column="2" Grid.Row="4"
                         HorizontalAlignment="Left"
                         Property="{Binding Path=Data.IsNYMEXHoliday}"
                         TargetControl="{Binding ElementName=IsNYMEXHolidayCheckBox}"/>

Does anyone have an idea of what I am doing wrong?  By the way, this whole object, Holiday is in a grid that is defined as follows:

<Grid x:Name="LayoutRoot"  DataContext="{StaticResource Holiday}">

Any advice/help/recomendations would be greatly appreciated.  I didn't think a stinken CheckBox would cause me so many problems!

Keith aka CyclingFoodmanPA

ajj3085 replied on Thursday, January 07, 2010

Its hard to say just seeing your Xaml, but this thread post helped someone else... maybe it will help you.

FoodmanCyclingPA replied on Thursday, January 07, 2010

Yep, it was the binding.  The code s/b as follows:

    <TextBlock x:Name="IsNYMEXHoliday"
        Grid.Column="0" Grid.Row="4"
        Text="NYMEX Holiday"/>
    <CheckBox x:Name="IsNYMEXHolidayCheckBox"
              Grid.Column="1" Grid.Row="4"
              IsChecked="{Binding Path=Data.IsNYMEXHoliday, Mode=TwoWay}"
              IsThreeState="False"
              IsEnabled="True" />
   <csla:PropertyStatus Grid.Column="2" Grid.Row="4"
                         HorizontalAlignment="Left"
                         Property="{Binding Path=Data.IsNYMEXHoliday}"
                         TargetControl="{Binding ElementName=IsNYMEXHolidayCheckBox}"/>

Notice the IsChecked Path now = Data.IsNYMEXHoliday instead of IsNYMEXHoliday.

Thanks for steering me in the right direction.

Keith

ajj3085 replied on Thursday, January 07, 2010

No problem.

That trick is exteremly helpful to find binding errors in Wpf, so its always the first place I look. 

Copyright (c) Marimer LLC