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

[Bug] RadDataForm+RadNumericUpDown

2 Answers 109 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Doxxer
Top achievements
Rank 1
Doxxer asked on 26 Oct 2012, 05:32 AM
Hi.

I've found weird behaviour in RadDataForm with some RadNumericUpDown inside.
I've created simple project:

1. Model:
public class Model : INotifyPropertyChanged
{
    public Model()
    {
        _first = 123;
        _second = 434;
    }  
 
    private int _first;
    public int First
    {
        get { return _first; }
        set
        {
            if (_first != value)
            {
                _first = value;
                OnPropertyChanged("First");
            }
        }
    }
 
    private int _second;
    public int Second
    {
        get { return _second; }
        set
        {
            if (_second != value)
            {
                _second = value;
                OnPropertyChanged("Second");
            }
        }
    }
 
    public event PropertyChangedEventHandler PropertyChanged;
    protected virtual void OnPropertyChanged(string propertyName)
    {
        var handler = PropertyChanged;
        if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    }  
}

2. XAML:
<UserControl x:Class="SilverlightApplication16.MainPage"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:SilverlightApplication16="clr-namespace:SilverlightApplication16"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             d:DesignHeight="300"
             d:DesignWidth="400"
             mc:Ignorable="d">
    <UserControl.DataContext>
        <SilverlightApplication16:Model />
    </UserControl.DataContext>
    <UserControl.Resources>
        <DataTemplate x:Key="dataFormTemplate">
            <StackPanel>
                <telerik:DataFormDataField DataMemberBinding="{Binding First}" IsTabStop="False">
                    <telerik:RadNumericUpDown Name="FistNUD"
                                              IsInteger="True"
                                              UpdateValueEvent="PropertyChanged"
                                              Value="{Binding First, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                </telerik:DataFormDataField>
                <telerik:DataFormDataField DataMemberBinding="{Binding Second}" IsTabStop="False">
                    <telerik:RadNumericUpDown Name="SecondNUD"
                                              IsInteger="True"
                                              UpdateValueEvent="PropertyChanged"
                                              Value="{Binding Second, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
 
                </telerik:DataFormDataField>
            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>
    <StackPanel Orientation="Vertical">               
        <telerik:RadDataForm AutoEdit="True"
                             AutoGenerateFields="False"
                             CommandButtonsVisibility="None"
                             CurrentItem="{Binding}"
                             EditTemplate="{StaticResource dataFormTemplate}" />
        <TextBlock Text="{Binding First}" />
        <TextBlock Text="{Binding Second}" />
    </StackPanel>
</UserControl>

3. MainPage code-behind:

using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
 
namespace SilverlightApplication16
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
 
            GotFocus += OnGotFocus;
            LostFocus += OnLostFocus;
        }
 
        void OnLostFocus(object sender, RoutedEventArgs e)
        {
            var focusedElement = e.OriginalSource as FrameworkElement;
            if (focusedElement != null)
            {
                Debug.WriteLine("LostFocus - {0}", focusedElement.Name);
            }
        }
 
        void OnGotFocus(object sender, RoutedEventArgs e)
        {
            var focusedElement = FocusManager.GetFocusedElement() as FrameworkElement;
            if (focusedElement != null)
            {
                var parent = VisualTreeHelper.GetParent(focusedElement) as FrameworkElement;
                var radNumeric = VisualTreeHelper.GetParent(parent) as FrameworkElement;
 
                string parentName = radNumeric != null ? radNumeric.Name : "Parent is null";
 
                Debug.WriteLine("GotFocus! focused now - {0}. Parent Is {1}", focusedElement.Name, parentName);
            }
        }
    }
}

4. Issue is here:
a. Build app. Start it.
b. Click on the first NumericUpDown.
c. Click on second NumericUpDown.
d. Silverlight plugin is freezed! Note the output window in the Visual Studio (in debug mode):
..................
GotFocus! focused now - textbox. Parent Is FistNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is SecondNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is FistNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is SecondNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is FistNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is SecondNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is FistNUD
LostFocus - textbox
GotFocus! focused now - textbox. Parent Is SecondNUD
...............

Note:
1. there is no bug if i remove AutoGenerateFields="False" from RadDataForm.
2.There is no bug with standart silverlight toolkit NumericUpDown.

So, is there any workaround?
Thank you and sorry for my english. I would appreciate a fast response.

[Edited-1]
I'm using Silverlight 5.0, VS 2012, Telerik components v.2012 Q2 SP2

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 31 Oct 2012, 08:49 AM
Hello,

Thank you for writing to us.

Could you try to reproduce the issue with our latest 2012 3 1017 release dlls and lets us know if the issue persists?

Regards,
Vladi
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Doxxer
Top achievements
Rank 1
answered on 31 Oct 2012, 09:51 AM
Thank you, it's ok. Issue doesn't persist after upgrade to Q3 2012.
Tags
NumericUpDown
Asked by
Doxxer
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Doxxer
Top achievements
Rank 1
Share this question
or