IsEditable cause HRESULT E_FAIL

11 posts, 0 answers
  1. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 05 Jul 2012 Link to this post

    1. RadComboBox in a RadWindow
    2. RadComboBox bind to a viewmodel's property, which type is Guid?
    3. The viewmodel implement IDataErrorInfo
    4. Set the RadComboBox's IsEditable to true,

    When chose a item from the RadCombox and the property's value from null to a Guid value, viewmodel then validate and add a data errorinfo to IDataErrorInfo(the business logical doesn't allow the property value not null), will cause  HRESULT E_FAIL

       at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
       at MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, Boolean b)
       at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
       at System.Windows.Controls.ToolTip.OpenPopup()
       at System.Windows.Controls.ToolTip.OnIsOpenChanged(Boolean isOpen)
       at System.Windows.Controls.ToolTip.OnIsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
       at System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
       at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
       at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
       at System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
       at System.Windows.Controls.ToolTip.set_IsOpen(Boolean value)
       at Telerik.Windows.Controls.Chromes.ValidationTooltip.UpdateTooltip()
       at Telerik.Windows.Controls.Chromes.ValidationTooltip.OnApplyTemplate()
       at System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)

    If set the RadComboBox's IsEditable to false, no exception happen. 

  2. Pavel
    Pavel avatar
    1 posts
    Member since:
    Feb 2009

    Posted 06 Jul 2012 Link to this post

    I have the same problem when editing is allowed

    ##XAML
    <telerik:RadComboBox VerticalAlignment="Center"
                             Width="250"
                             Text="{Binding Value, Mode=TwoWay, ValidatesOnExceptions=True, ValidatesOnNotifyDataErrors=True,
                                NotifyOnValidationError=True,
                                UpdateSourceTrigger=PropertyChanged}"
                             ItemsSource="{Binding PossibleValues}"
                             ClearSelectionButtonContent="True"
                             ClearSelectionButtonVisibility="Collapsed"
                             CanAutocompleteSelectItems="True"
                             CanKeyboardNavigationSelectItems="True"
                             IsEditable="True"
                             IsReadOnly="False"
                             OpenDropDownOnFocus="False"
                             IsFilteringEnabled="False" />

  3. DevCraft banner
  4. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 08 Jul 2012 Link to this post

    If using implicit style to apply a telerik theme to a checkbox, the same exception .occurs

    <telerik:Office_BlueTheme x:Key="AppTheme" />

    <Style TargetType="CheckBox" telerik:StyleManager.BasedOn="{StaticResource AppTheme}"/>

    I guess telerik silverlight RadControls's validation error tip popup cause those exception.
  5. Georgi
    Admin
    Georgi avatar
    347 posts

    Posted 10 Jul 2012 Link to this post

    Hi,

    As you can see in this PITS item the issue was recently fixed and the fix is available in the Latest Internal Build from yesterday.
    It would be great If you can check it out and If you are still experiencing the issue, please don't hesitate to contact us.


    Greetings,
    Georgi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Kairat
    Kairat avatar
    7 posts
    Member since:
    Mar 2011

    Posted 10 Jul 2012 Link to this post

    I have the same error when using 02156RadControls_for_Silverlight5_2012_2_0709_TRIAL_hotfix:
    в MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    в MS.Internal.XcpImports.SetValue(IManagedPeerBase obj, DependencyProperty property, Boolean b)
    в System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
    в System.Windows.Controls.Primitives.Popup.set_IsOpen(Boolean value)
    в System.Windows.Controls.ToolTip.OpenPopup()
    в System.Windows.Controls.ToolTip.OnIsOpenChanged(Boolean isOpen)
    в System.Windows.Controls.ToolTip.OnIsOpenPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
    в System.Windows.DependencyObject.RaisePropertyChangeNotifications(DependencyProperty dp, Object oldValue, Object newValue)
    в System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)
    в System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean allowReadOnlySet, Boolean isBindingInStyleSetter)
    в System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value)
    в System.Windows.DependencyObject.SetValue(DependencyProperty property, Boolean b)
    в System.Windows.Controls.ToolTip.set_IsOpen(Boolean value)
    в Telerik.Windows.Controls.Chromes.ValidationTooltip.UpdateTooltip()
    в Telerik.Windows.Controls.Chromes.ValidationTooltip.OnApplyTemplate()
    в System.Windows.FrameworkElement.OnApplyTemplate(IntPtr nativeTarget)


  7. Georgi
    Admin
    Georgi avatar
    347 posts

    Posted 11 Jul 2012 Link to this post

    Hello Kairat,

    Can you give us more details about your scenario?
    It would be great if you can put together a simple project reproducing the issue.
    So any information would be appreciated.

    Regards,
    Georgi
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  8. sysinfradev
    sysinfradev avatar
    5 posts
    Member since:
    Sep 2011

    Posted 12 Jul 2012 Link to this post

    Hi,

    I am experiencing exactly the same issue as Kairat above, and am receiving the same error message and stack trace, using the same internal build of RadControls for Silverlight 5.

    For my scenario, I have been able to narrow the cause down to a RadComboBox within a RadWindow.  If an invalid value is entered and the validation notification needs to be displayed, the COM exception is thrown.

    I have tested the same scenario (RadComboBox with validation error) without a RadWindow, and that does not throw the same exception. I have included the code from a sample project that will demonstrate the behaviour below:

    MainPage.xaml
    <UserControl x:Class="SilverlightApplication3.MainPage"
        xmlns:SilverlightApplication3="clr-namespace:SilverlightApplication3"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" mc:Ignorable="d"
        d:DesignHeight="300" d:DesignWidth="400">
        <UserControl.DataContext>
            <SilverlightApplication3:ViewModel />
        </UserControl.DataContext>
     
        <Grid x:Name="LayoutRoot" Background="White">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <telerik:RadComboBox  Height="23" Grid.Row="0"  Margin="10" Width="120" ItemsSource="{Binding Items}" SelectedItem="{Binding Value, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" />
            <Button Grid.Row="1" Content="Open Window" Click="Button_Click" Width="100" />
        </Grid>
    </UserControl>

    MainPage.xaml.cs
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
     
    namespace SilverlightApplication3
    {
        public partial class MainPage : UserControl
        {
            public MainPage()
            {
                InitializeComponent();
            }
     
            private void Button_Click(object sender, RoutedEventArgs e)
            {
                ChildWindowTest widnow = new ChildWindowTest();
                widnow.ShowDialog();
            }
        }
    }


    ChildWindowTest.xaml
    <telerik:RadWindow x:Class="SilverlightApplication3.ChildWindowTest"
                       xmlns:SilverlightApplication3="clr-namespace:SilverlightApplication3" Header="ChildWindowTest" Height="300" Width="300">
        <telerik:RadWindow.DataContext>
            <SilverlightApplication3:ChildWindowViewModel />
        </telerik:RadWindow.DataContext>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <telerik:RadComboBox  Height="23" Grid.Row="0" Margin="10" Width="120" ItemsSource="{Binding Items}" SelectedItem="{Binding Value, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}" />
        </Grid>
    </telerik:RadWindow>

    ViewModels.cs
    using System;
    using System.Collections.ObjectModel;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Net;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Documents;
    using System.Windows.Ink;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Animation;
    using System.Windows.Shapes;
     
    namespace SilverlightApplication3
    {
        public class ViewModel : INotifyPropertyChanged
        {
            private string item;
            [Required]
            public string Value
            {
                get { return item; }
                set
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "Value" });
                    if (item != value)
                    {
                        item = value;
                        RaisePropertyChanged("Value");
                    }
                }
            }
     
            public ObservableCollection<string> Items { get; private set; }
     
            public ViewModel()
            {
                Items = new ObservableCollection<string>(new[] { "Item 1", "Item 2", "Item 3" });
            }
     
            protected void RaisePropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
            public event PropertyChangedEventHandler PropertyChanged;
        }
     
        public class ChildWindowViewModel : INotifyPropertyChanged
        {
            private string item;
            [Required]
            public string Value
            {
                get { return item; }
                set
                {
                    Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "Value" });
                    if (item != value)
                    {
                        item = value;
                        RaisePropertyChanged("Value");
                    }
                }
            }
     
            public ObservableCollection<string> Items { get; private set; }
     
            public ChildWindowViewModel()
            {
                Items = new ObservableCollection<string>(new[] { "Item 1", "Item 2", "Item 3" });
            }
     
            protected void RaisePropertyChanged(string propertyName)
            {
                if (PropertyChanged != null)
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
            public event PropertyChangedEventHandler PropertyChanged;
        }
    }


    Using the above code, you should see that the RadComboBox on the main page validates correctly when cleared (i.e. show the validation tooltip, etc).  Clicking on the 'Open Window' button will display a child window with another RadComboBox on it.  This RadComboBox does not validate correctly when cleared; it instead throws a COM exception.

    Looking forward to hearing from you soon.
  9. Georgi
    Admin
    Georgi avatar
    347 posts

    Posted 13 Jul 2012 Link to this post

    Hello sysinfradev,

    We were able to reproduce the issue even with the latest assembles, but the good news is that we have find out the additional problem and it should be fix for the next internal build, which is scheduled for the next Monday. We have also updated our PITS issue on the matter where you can also track if the issue is fixed.

    Regards,
    Georgi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  10. yjh
    yjh avatar
    67 posts
    Member since:
    Aug 2007

    Posted 19 Jul 2012 Link to this post

    By the way, the validation error tooltips style of RadControls is ugly.

    Why not keep same style as native ?
  11. Robert Pelzer
    Robert Pelzer avatar
    15 posts
    Member since:
    Aug 2009

    Posted 02 Aug 2012 Link to this post

    Hey Telerik, 

    I'm also experiencing this issue as well however mine is with a radmaskedtextbox hosted within a rad window. I get the same errror when i raise a validation exception when the lenghth of the phone isn't 10 characters. Our whole App just crashes.  

    here's my code:

    XAML:
    <telerikInput:RadComboBox  x:Name="rcbPhone2" VerticalAlignment="Center" Margin="0 5 5 5" 
                                                           IsEditable="True" IsTextSearchEnabled="True" IsEnabled="{Binding IsInEditMode}"
                                                           telerik2:TextSearch.TextPath="DescriptionFormatted" 
                                                           SelectedValue="{Binding Phone2DescID, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}" 
                                                           SelectedValuePath="ID" ItemsSource="{Binding Phones}"
                                                           IsReadOnly="True" Width="100">

    ViewModel:
    Private _Phone2 As String
        Public Property Phone2 As String
            Get
                Return _Phone2
            End Get
            Set(ByVal value As String)
                If (value Is Nothing OrElse value.Length = 0 OrElse Regex.IsMatch(value, "(?sm)^(\d{10})$")) Then
                    SetValue(_Phone2, value, "Phone2")
                    _Phone2 = value
                    Me.OnPropertyChanged("Phone2")
                    compareValue()
                Else
                    Throw New ValidationException("The Phone field must have a length of 10 characters.")
                End If
     
            End Set
        End Property

  12. Georgi
    Admin
    Georgi avatar
    347 posts

    Posted 06 Aug 2012 Link to this post

    Hi Ryan,

    As you can see in the PITS item, the issue was fixed and the fix is available in Q2 2012 SP. Could you, please give it a try and let us know if everything works ok?

    Kind regards,
    Georgi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
DevCraft banner