This question is locked. New answers and comments are not allowed.
Hi.
I've found weird behaviour in RadDataForm with some RadNumericUpDown inside.
I've created simple project:
1. Model:
2. XAML:
3. MainPage code-behind:
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):
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
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: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