This question is locked. New answers and comments are not allowed.
Hi there,
I have a number of RadMaskedNumericInput and RadMaskedCurrencyInput in an StackPanel. The StackPanel is part of a form used to edit an entity. The IsReadOnly of the fields is bound in MVVM Style to a property. The problem we have is that the fields behave in a strange way sometimes and remain blocked (IsReadOnly = true) although the bound property was changed. The strange behavior doesn't affect all fields.
Here is the View I use
Here is the Code Behind
And here is the ViewModel
In order to reproduce the behavior, please do the following:
- Start project (F5)
- Expand the expander, you will see 5 RadMaskedNumericInput fields in a StackPanel
- Press the button titled "Change Enabled Status Of RadMaskedNumericInput"
- You will see that all five are now enabled and can be edited
- Set the cursor in the upper most of the fields
- Use the scroll bar to the right and hide 3 of the fields
- Set the cursor in the two remaining fields
- Scroll back to the top and try to set the cursor in the upper most of the fields, it doesn't work
- Try to set the cursor in the other fields, and some might, others might not work
- Trying to move using tab functions, but the disabled fields don't show their content once you move there with tab.
I would really appreciate your help on this, RadMaskedInput fields are really promising, but this problem keeps on poping up on my forms (most implement the RadInputs inside Expanders).
Best regards and thank you for you help
I have a number of RadMaskedNumericInput and RadMaskedCurrencyInput in an StackPanel. The StackPanel is part of a form used to edit an entity. The IsReadOnly of the fields is bound in MVVM Style to a property. The problem we have is that the fields behave in a strange way sometimes and remain blocked (IsReadOnly = true) although the bound property was changed. The strange behavior doesn't affect all fields.
Here is the View I use
<UserControl x:Class="SilverlightApplication1.MainPage" xmlns:Controls="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="400"> <UserControl.Resources> <Style x:Key="NumericInputStyle" TargetType="Controls:RadMaskedNumericInput" > <Setter Property="FontSize" Value="16" /> <Setter Property="Margin" Value="0" /> <Setter Property="EmptyContent" Value="0,00" /> <Setter Property="Placeholder" Value=" " /> <Setter Property="AllowSkipPlaceholders" Value="False" /> <Setter Property="AutoFillZeros" Value="False" /> <Setter Property="IsClearButtonVisible" Value="False" /> <Setter Property="AutoFillNumberGroupSeparators" Value="False" /> <Setter Property="TextMode" Value="PlainText" /> <Setter Property="SelectionOnFocus" Value="SelectAll" /> <Setter Property="Mask" Value="#4.2" /> <Setter Property="Width" Value="75" /> <Setter Property="Height" Value="32" /> </Style> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White"> <ScrollViewer> <telerik:RadExpander IsExpanded="False" Background="#FFEEEEEE" Foreground="Black" BorderBrush="Black" BorderThickness="1" Width="500" Margin="0,5,0,0"> <StackPanel Height="1800"> <StackPanel Margin="0,8,0,3" Background="White"> <Controls:RadMaskedNumericInput Value="{Binding Path=Value0, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Style="{StaticResource NumericInputStyle}" IsEnabled="{Binding Path=IsEnabled}"></Controls:RadMaskedNumericInput> </StackPanel> <StackPanel Margin="0,8,0,3" Background="White"> <Controls:RadMaskedNumericInput Value="{Binding Path=Value1, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Style="{StaticResource NumericInputStyle}" IsEnabled="{Binding Path=IsEnabled}"></Controls:RadMaskedNumericInput> </StackPanel> <StackPanel Margin="0,8,0,3" Background="White"> <Controls:RadMaskedNumericInput Value="{Binding Path=Value2, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Style="{StaticResource NumericInputStyle}" IsEnabled="{Binding Path=IsEnabled}"></Controls:RadMaskedNumericInput> </StackPanel> <StackPanel Margin="0,8,0,3" Background="White"> <Controls:RadMaskedNumericInput Value="{Binding Path=Value3, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Style="{StaticResource NumericInputStyle}" IsEnabled="{Binding Path=IsEnabled}"></Controls:RadMaskedNumericInput> </StackPanel> <StackPanel Margin="0,8,0,3" Background="White"> <Controls:RadMaskedNumericInput Value="{Binding Path=Value4, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" Style="{StaticResource NumericInputStyle}" IsEnabled="{Binding Path=IsEnabled}"></Controls:RadMaskedNumericInput> </StackPanel> <Button Content="Change Enabled Status Of RadMaskedNumericImput" Click="Button_Click" /> </StackPanel> </telerik:RadExpander> </ScrollViewer> </Grid></UserControl>Here is the Code Behind
using System.Windows;using System.Windows.Controls;namespace SilverlightApplication1{ public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); DataContext = new ViewModel(); } private void Button_Click(object sender, RoutedEventArgs e) { ((ViewModel)DataContext).IsEnabled = !((ViewModel)DataContext).IsEnabled; } }}And here is the ViewModel
using System.ComponentModel;namespace SilverlightApplication1{ public class ViewModel : INotifyPropertyChanged { public ViewModel() { Value1 = 2; Value2 = (decimal)1.1; Value3 = (decimal) 10.4; Value4 = (decimal) 245.15; } public event PropertyChangedEventHandler PropertyChanged; /// <summary> /// Raises a PropertyChanged event /// </summary> protected void OnPropertyChanged(string property) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(property)); } } private bool _isEnabled; public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; OnPropertyChanged("IsEnabled"); } } public decimal? Value0 { get; set; } public decimal? Value1 { get; set; } public decimal? Value2 { get; set; } public decimal? Value3 { get; set; } public decimal? Value4 { get; set; } }}In order to reproduce the behavior, please do the following:
- Start project (F5)
- Expand the expander, you will see 5 RadMaskedNumericInput fields in a StackPanel
- Press the button titled "Change Enabled Status Of RadMaskedNumericInput"
- You will see that all five are now enabled and can be edited
- Set the cursor in the upper most of the fields
- Use the scroll bar to the right and hide 3 of the fields
- Set the cursor in the two remaining fields
- Scroll back to the top and try to set the cursor in the upper most of the fields, it doesn't work
- Try to set the cursor in the other fields, and some might, others might not work
- Trying to move using tab functions, but the disabled fields don't show their content once you move there with tab.
I would really appreciate your help on this, RadMaskedInput fields are really promising, but this problem keeps on poping up on my forms (most implement the RadInputs inside Expanders).
Best regards and thank you for you help