Hello again.
I have a problem trying to display PropertyStatus. Here is some of my code.
<TextBox x:Name="FirstNameTextbox" Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" Margin="6,6,6,6" Text="{Binding Mode=TwoWay, Path=Data.FirstName}"/>
<csla:PropertyStatus RelativeTargetName="FirstNameTextbox" Property="FirstName" Source="{Binding Path=Data}" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Left"/>Blend displays the PropertyStatus as an error notifying Control_TargetMismatch and I also get the error "VisualTreeHelper_ReferenceIsNotAValidDO". The last error disappears when I remove the RelativeTargetName
LayoutRoot is set up to have a business object called Player as DataContext.
Everything works fine when I use control:DataGrid.
Appreciate any help.
/Peter
>Everything works fine when I use control:DataGrid.
What does this mean?
Oh, sorry I missed a few things there :/
I also use a DataGrid that is bound to same source. That DataGrid contains a few <csla:ValidatedDataGridTextColumn> These give a notification if the business object is valid or not.
Somehow I can't get the PropertyStatus control from the Csla.Silverlight library to work. I can't even get them displayed in Blend, since I get the error Control_TargetTypeMismatch, and also the "VisualTreeHelper_ReferenceIsNotAValidDO" when I set the RelativeTargetName to a textbox.
/Peter
Another small update. I managed to get the PropertyStatus to be displayed in my application when running it. But it's impossible to open it in design view in Expression Blend, and Blend also gives a notification that the XAML is faulty.
VS 2008 does not have any problem with the XAML, and the application runs just perfectly.
/Peter
Fwiw, the code I showed is from the SimpleApp sample in the
Samples download – though I did add the RelativeTargetName to match what
you are doing. But I am able to open that XAML page in Blend, and interact with
the PropertyStatus control.
Rocky
Did anyone find a solution for the Control_TargetTypeMismatch.
I find it happens on the <csla:BusyAnimation
and the <csla:PropertyStatus
Strange thing is one day it could be perfectly fine and then the next it does not work at all. Problem does not seem to effect VS2008 builds
Thanks
Jeremy
I'm not sure what to suggest. I do my binding expressions a little differently from what you are doing (and I know we have samples like yours - I just prefer this other approach). My guess is that you have some mix-up in the binding expressions.
Here's mine:
<Grid x:Name="LayoutRoot"
DataContext="{Binding Source={StaticResource MyData}, Path=Data}">
That sets the overall context to the business object. Notice the Path=Data on the context line, so the overall context isn't the dataprovider, it is the business object.
<TextBox x:Name="NameTextBox"
Width="150"
Text="{Binding Name, Mode=TwoWay}" />
<csla:PropertyStatus RelativeTargetName="NameTextBox"
Property="Name" Source="{Binding}" />
Here I'm just binding against the business object. I don't see where the RelativeTargetName is different from your approach - though it is important to understand that the TextBox and PropertyStatus controls are in the same container, so no relative path is required to navigate from one to the other.
And maybe the binding expressions aren't the issue either, I don't know. I'm just comparing code I have running to yours to see differences.
Copyright (c) Marimer LLC