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

ReadOnlyTemplate+CommandButtonsVisibility

1 Answer 103 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Tomasz
Top achievements
Rank 1
Tomasz asked on 28 May 2013, 02:18 PM
Hello,
 Im using the RadDataForm Control together with the RadGrid Control. They both are based on the same collection of type
 QueryableCollectionView. The objects in the collection are class based objects, the class implements IEditableObject, INotifyPropertyChanged,IDataErrorInfo intrrfaces. My problem is that I want to hide the Commit and the Cancel button but only when
RadDataForm is in ReadOnlyMode, is this possible do this in other way than implementing my own buttons?
<telerik:RadDataForm.ReadOnlyTemplate>
                            <DataTemplate>
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="Auto" />
                                        <RowDefinition Height="Auto" />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="Auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Label Grid.Row="0" Grid.Column="0" Width="40" Content="Key" IsTabStop="False" />
                                    <Label Grid.Row="1" Grid.Column="0" Width="40" Content="Value" IsTabStop="False"/>
                                    <TextBox Grid.Row="0" Grid.Column="1" Width="170" Height="23" Foreground="Black" Text="{Binding Key}" IsTabStop="False"  IsEnabled="False" TextWrapping="Wrap" IsReadOnly="True"  />
                                    <TextBox Grid.Row="1" Grid.Column="1" Width="170" Height="23" Foreground="Black" Text="{Binding Value}" IsTabStop="False" TextWrapping="Wrap" IsEnabled="False" IsReadOnly="True" />
                                </Grid>
                            </DataTemplate>
                        </telerik:RadDataForm.ReadOnlyTemplate>

Also is it possible to scroll to the new added row of the grid when Im adding it using RadDataForms add button ?

Regards,

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 31 May 2013, 11:23 AM
Hi Tomasz,

You can try handling BeginningEdit and EditEnded events and set the CommandsButtonsVisibility property to the values you want. For example:

private void dataForm_BeginningEdit(object sender, System.ComponentModel.CancelEventArgs e)
        {
            this.dataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.All;
        }
 
        private void dataForm_EditEnded(object sender, Telerik.Windows.Controls.Data.DataForm.EditEndedEventArgs e)
        {
            this.dataForm.CommandButtonsVisibility = DataFormCommandButtonsVisibility.Edit;
        }
 

Regards,
Maya
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
DataForm
Asked by
Tomasz
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or