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

Breaking changes in DataForm in version 2021.1.119

3 Answers 133 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Iron
Thomas asked on 11 Feb 2021, 05:54 PM

Hi @ all,

In the last WPF build the DataForm control got changed (single, multiple editors).
But this change broke some other functionality of the control.

I attached a screenshot of small test project when using controls from version 2020.3.1020
And also the screenshot when using controls from version 2021.1.119

This is basically the XAML code I used for the view:

<Window
    x:Class="TelerikDataFormTest.MainWindow"
    Title="MainWindow"
    Width="525"
    Height="350">
    <Window.Resources>
 
        <DataTemplate x:Key="DataFormEditTemplate">
            <StackPanel Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="0.5*" />
                    </Grid.ColumnDefinitions>
 
                    <StackPanel Grid.Column="0">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="250"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
 
                    <StackPanel Grid.Column="1">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="250"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
                </Grid>
            </StackPanel>
        </DataTemplate>
 
        <DataTemplate x:Key="DataFormReadOnlyTemplate">
            <StackPanel Margin="10">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.5*" />
                        <ColumnDefinition Width="0.5*" />
                    </Grid.ColumnDefinitions>
 
                    <StackPanel Grid.Column="0">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <telerik:RadButton
                                Width="150"
                                Margin="0,5,0,5"
                                HorizontalAlignment="Left"
                                Content="Test Button" />
                        </telerik:DataFormDataField>
                    </StackPanel>
 
                    <StackPanel Grid.Column="1">
                        <telerik:DataFormDataField DataMemberBinding="{Binding DataName}" Label="Name" />
                        <telerik:DataFormDataField Label="Date">
                            <telerik:RadDatePicker SelectedValue="{Binding DataDate}" TodayButtonVisibility="Visible" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField Label=" ">
                            <StackPanel>
                                <telerik:RadButton
                                    Width="150"
                                    Margin="0,5,0,5"
                                    HorizontalAlignment="Left"
                                    Content="Test Button" />
                            </StackPanel>
                        </telerik:DataFormDataField>
 
                    </StackPanel>
                </Grid>
            </StackPanel>
        </DataTemplate>
 
    </Window.Resources>
 
 
    <Grid>
 
 
        <telerik:RadDataForm
            Width="400"
            Height="300"
            HorizontalAlignment="Left"
            VerticalAlignment="Top"
            AutoEdit="True"
            AutoGenerateFields="False"
            CurrentItem="{Binding Data}"
            EditTemplate="{StaticResource DataFormEditTemplate}"
            ReadOnlyTemplate="{StaticResource DataFormReadOnlyTemplate}" />
 
    </Grid>
</Window>

Until the change this worked for years now and is also used in our projects.
The question is: Is this a bug or a wanted behaviour of this control.
If there won't be a chance to use the old setting somehow we're stuck with the old version from now on.

I'm really looking forward to your suggestion on this topic.

Kind Regards,
Thomas

3 Answers, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 16 Feb 2021, 09:17 AM

Hello Thomas,

Thank you for the provided information. The reported issue is a known bug in the RadDataForm control introduced with some internal code changes in the last release. Basically, the Content of the DataFormDataField element is never used. You can find this logged in the our feedback portal.

Note that the issue is already fixed. You can test it with the latest internal build (LIB) version. Also, we will release a service pack at the end of this month where the fix will be available too.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Mattias
Top achievements
Rank 1
answered on 09 Mar 2021, 09:26 AM

I've updated to the lastest version 2021.1.223 and still have the same problem.

The way I've done it is that I change the e.DataField.Content property in the AutoGeneratingField event handler.
This change seems to have no effect and I always get the default control instead of the one i change to.

Maybe we should do this another way but we have had it like this years with no problems.

0
Martin Ivanov
Telerik team
answered on 12 Mar 2021, 08:47 AM

Hello Thomas,

Thank you for the additional information. Indeed this scenario wasn't covered by the provided fix. This is why I've logged a new report and we will do our best to fix it as soon as possible. In the meantime, you can work this around by defining the data fields manually instead of using the automatic generation. Or alternatively, you can use a dispatcher in order to delay the content setting in the event handler.

private void RadDataForm_AutoGeneratingField(object sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                e.DataField.Content = new TextBlock() { Text = "test" };
            }));
        }

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataForm
Asked by
Thomas
Top achievements
Rank 1
Iron
Answers by
Martin Ivanov
Telerik team
Mattias
Top achievements
Rank 1
Share this question
or