DataForm AddNew()?

DataForm AddNew()?

Old forum URL:

Ranjini posted on Wednesday, June 16, 2010

Tools -  CSLA 4/Silverlight4

I have researched here and generally on the web as well and cannot seem to find a good direction for my problem, so I thought I will post it here and see what I get.

I have a BB object with a BLB child list. On the UI for editing this BB object, I have a DataForm for editing the BLB child object. Here the XAML for this part

<df:DataForm x:Name="dfDomainCPEdit" Margin="5,5,5,5" LabelPosition="Left" AutoEdit="False" AutoCommit="True" AutoGenerateFields="True"

CommitButtonContent="Save" CancelButtonContent="Cancel" CommandButtonsVisibility = "Navigation, Add, Delete"

ItemsSource="{Binding CustomPropertyTypes, Mode=TwoWay}" CurrentItem="{Binding SelectedItem,ElementName=dgCustomPropertyType, Mode=TwoWay}" />

<csla:TriggerAction Height="0" Name="AddCustomPropertyTrigger" Width="0" DataContext="{Binding Source={StaticResource domainEditModel }}"

TargetControl="{Binding ElementName=dfDomainCPEdit}" MethodName="AddCustomProperty" TriggerEvent ="AddingNewItem" />


What I want to do is override the default “add” behavior, so I can add my child object using the CSLA AddNew(). However, if I do it this way, I get 2 child items added to my list, one good (via TriggerAction) and one bad (default add behavior of DataForm). Can someone clarify what it is that I need to be doing to get the behavior I want?

Thanks !


Copyright (c) Marimer LLC