This is a migrated thread and some comments may be shown as answers.

More row details and dataform questions

1 Answer 78 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Randy Hompesch
Top achievements
Rank 1
Randy Hompesch asked on 29 Nov 2016, 10:46 AM

Hi,
below is a stripped down version of my rowdetail editor using a raddataform with a rowdetails template.
I tried adding CommandButtonsVisibility="All" but it did nothing. I want to show add, delete, edit etc. I'm only getting the edit button.

Some more issues.

1. The OK and Cancel Buttons are not picking up the global button style I have set in app.xaml.

2. Is it possible to have the OK button fire the RowEditEnded event?

3. The cancel button does not cancel the changes made in the dataform. Changes made to the form are immediately reflected in the
     RadGridView. I would have expected the cancel button to set things back to their original values. Am I missing something?

4. How do I get the radform to default to edit mode so that the user does not have to hit the edit button in the upper right corner first?

I've attached a screen shot.

Any help would be GREATLY appreciated.

Thanks ... Ed

 


<Grid.Resources>
    <DataTemplate x:Key="RowDetailsTemplate">
        <telerik:RadTabControl x:Name="SamplesTab"   HorizontalAlignment="Left"
                                    Margin="8" VerticalAlignment="Center">
            <telerik:RadTabItem Header="Sample Details" DataContext="{Binding}">

                <Grid Width="Auto" HorizontalAlignment="Stretch">
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>

                    <telerik:DataFormDataField    Grid.Row="0" Grid.Column="0"
                                                    Label="Client Sample Id:"
                                                    DataMemberBinding="{Binding Sample.ClientSampleID, Mode=TwoWay }"
                                                    VerticalAlignment="Top"  />

                    <telerik:DataFormComboBoxField Grid.Row="1" Grid.Column="0" Label="Priority:"
                                                    ItemsSource="{Binding RelativeSource={RelativeSource FindAncestor,
                                                            AncestorType={x:Type UserControl} },
                                                            Path=DataContext.Priorities}"
                                                    DisplayMemberPath="Value"
                                                    SelectedValuePath="Key"
                                                    DataMemberBinding="{Binding Sample.PriorityID, Mode=TwoWay }">

                    </telerik:DataFormComboBoxField>
                </Grid>
            </telerik:RadTabItem>
        </telerik:RadTabControl>

    </DataTemplate>
</Grid.Resources>



<telerik:RadGridView.RowDetailsTemplate>
    <DataTemplate>

        <telerik:RadDataForm CurrentItem="{Binding}" AutoGenerateFields="False"
            EditTemplate="{StaticResource RowDetailsTemplate}"
            NewItemTemplate="{StaticResource RowDetailsTemplate}"
            ReadOnlyTemplate="{StaticResource RowDetailsTemplate}"
                />
    </DataTemplate>
</telerik:RadGridView.RowDetailsTemplate>

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Dilyan Traykov
Telerik team
answered on 30 Nov 2016, 04:24 PM
Hello Ed,

1) RadDataForm's buttons are of type RadButton, which is probably the reason your custom styles are not applied to them.

2) When RadDataForm's edit is committed its EditEnded event. You can define a custom command in your viewmodel to handle this similarly to RadGridView's RowEditEnded event.

3) As suggested in the following article, If the items of your data source implement the IEditableObject or the INotifyPropertyChanged interface, you will be able to revert any pending changes with the Cancel button.

4) You can set RadDataForm's AutoEdit property to True in order to achieve the desired behavior.

I hope you find this information helpful. Please let me know if I can further assist you in any way.

Regards,
Dilyan Traykov
Telerik by Progress
Telerik UI for WPF is ready for Visual Studio 2017 RC! Learn more.
Tags
GridView
Asked by
Randy Hompesch
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Share this question
or