ReadOnlyTemplate+CommandButtonsVisibility

2 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    4 posts
    Member since:
    Dec 2012

    Posted 28 May 2013 Link to this post

    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,
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 31 May 2013 Link to this post

    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.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top