Hi Telerik ,
i have a problem but can´t see a solution yet.I do not know if its a bug somewhere.I hope you have a hint what could be the problem.
MVVM + WPF
1) I have a Grid + RadDataForm
<Grid> <telerik:RadDataForm x:Name="LookupListFormCtrl" Header="{Binding DisplayName,FallbackValue='Lookup'}" AutoGenerateFields="False" CommandButtonsVisibility="All" ItemsSource="{Binding Nodes,Mode=TwoWay}" CurrentItem="{Binding SelectedUiDataItem,Mode=TwoWay}" BorderBrush="Green" BorderThickness="6" ReadOnlyTemplate="{StaticResource LookupListFormDataTemplate}" EditTemplate="{StaticResource LookupListFormDataTemplate}" /> </Grid>
with the Resource Template as
<DataTemplate x:Key="LookupListGridDataTemplate" DataType="{x:Type local:LookupListGrid}">
<UniformGrid Columns="2">
<telerik:DataFormDataField Label="LOOKUP"
DataMemberBinding="{Binding lookup_lkp, Mode=TwoWay}"/>
<telerik:DataFormComboBoxField Label="GROUP LOOKUP"
DataMemberBinding="{Binding group_lookup_lkp, Mode=TwoWay}"
DisplayMemberPath="display_nam"
ItemsSource="{Binding Nodes.GroupLookups}"
SelectedValuePath="lookup_lkp"
IsComboboxEditable="False" />
<telerik:DataFormComboBoxField Label="PAR LKP LOOKUP"
DataMemberBinding="{Binding par_lkp_lookup_lkp, Mode=TwoWay}"
DisplayMemberPath="display_nam"
ItemsSource="{Binding Nodes.ParLkpLookups}"
SelectedValuePath="lookup_lkp"
IsComboboxEditable="True" />
<telerik:DataFormComboBoxField Label="PAR LKP GROUP LOOKUP"
DataMemberBinding="{Binding par_lkp_group_lookup_lkp, Mode=TwoWay}"
DisplayMemberPath="display_nam"
ItemsSource="{Binding Nodes.ParLkpGroupLookups}"
SelectedValuePath="lookup_lkp"
IsComboboxEditable="True" />
<telerik:DataFormDataField Label="DISPLAY"
DataMemberBinding="{Binding display_nam, Mode=TwoWay}"/>
<telerik:DataFormDataField Label="DISPLAY SHORT"
DataMemberBinding="{Binding display_short_txt, Mode=TwoWay}"/>
<telerik:DataFormCheckBoxField Label="VALID" DataMemberBinding="{Binding IsValidYn, Mode=TwoWay}" />
</UniformGrid>
</DataTemplate>
I query the Data from DB and it´s shown as well if i press the Update Button the Form changes to writable and all the Columns are viewable and changeable.
So Fine.
My "Nodes" Class ( = Item Source ) is derived from ObservableItemCollection<T> and enhanced with IEditableCollectionView, IEditableCollectionViewAddNewItem
In the derived Class the methods of IEditableCollectionView are written and linked to a class which is as well derived from
DataFormCommandProvider. ( because i encapsulate all the method calls there )
Additionaly this derived class is also added to the DataForm in the View Code behind.
parentcollection.CommandProvider.DataForm = LookupListFormCtrl;
At the End in the MyCommandProvider class a new Item is created and added to the Collection. ( this i see in the Debug Mode) and also the Current Item
is set to the new empty created Item.
Until here it looks fine but the Form doesn´t show me the "empty" Record i created , I checked also if the Current Item ( = SelectedUiDataItem )
is this newly created ones and it is. And also all the Can* Methods returning true.
First i thought there is somewhere a bug on my side but know i am not sure because
i changed AutoGenerateFields="True" and in this moment the Form show all the columns i expected.
In behind the same methods are called and new Item to collection is created.
In the derived Class of DataFormCommandProvider i called additionaly the .AddNew() before i created and added a new Item but anyhow it´s has no effect.
I think i have overseen some parameter to the xaml or forgot to set something so i hope on any hint from yours.
Thanks br Thomas Cinatl