Valdation Error system.Windows.Data Error: 4 ElementName=Holder

8 posts, 0 answers
  1. Ramon
    Ramon avatar
    11 posts
    Member since:
    Aug 2012

    Posted 28 Nov 2013 Link to this post

    I used an entity with IEditableObject, IDataErrorInfo now when ever an error happens and the validation kicks in marking the controller with the red marker also this error is thrown, any ideas why, the proram runs fine but with this error am using Themes.Implicit copyed them into th project and refrenced the assemblies of Binaries.NoXaml

    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:(no path); DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'PlacementTarget' (type 'UIElement')
    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:Path=AdornedElement.(0)[0].ErrorContent; DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'Content' (type 'Object')


    thank you
  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 02 Dec 2013 Link to this post

    Hello Ramon,

    Can you please elaborate a bit more on your scenario? If you can share with us the RadControls you're using along with their definitions, we will be able to further investigate the case. It would be also very helpful if you can isolate the issue in a small runnable project and send it to us so that we can try to reproduce the exceptions locally and investigate their origins.

    Thank you in advance for your cooperation.

    Regards,
    Tina Stancheva
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ramon
    Ramon avatar
    11 posts
    Member since:
    Aug 2012

    Posted 16 Dec 2013 Link to this post

    Hi thank you for taking the time to reply, Here the user object with an IDataErrorInfo now if used with a textbox the error is thrown in output,  tried different impleminations of IDataErrorInfo but same error, also if the property is not required but has a StringLength attribute it will show up as error with
    red marker  when not filled.


    error:

    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:(no path); DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'PlacementTarget' (type 'UIElement')
    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:Path=AdornedElement.(0)[0].ErrorContent; DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'Content' (type 'Object')




     


    <StackPanel Grid.Row="0" Orientation="Vertical">
                        <Label Content="{lex:Loc Key=FirstName}" VerticalAlignment="Center" />
                        <DockPanel >
                            <TextBox Text="{Binding User.FirstName, Mode=TwoWay,
                                ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
                                FocusManager.FocusedElement="{Binding RelativeSource={RelativeSource Self}}"/>
                        </DockPanel>
                    </StackPanel>


    public class User : BaseEntity, IDataErrorInfo
      {
          #region Declarations
          private Guid _userId;
          private string _firstName;
          #endregion
      
          public Guid UserId
          {
              get { return _userId; }
              set { SetPropertyValue("UserId", ref _userId, value); }
          }
           
          public string FirstName
          {
              get { return _firstName; }
              set { SetPropertyValue("FirstName", ref _firstName, value); }
          }
           
         
      
      
          string IDataErrorInfo.Error { get { return null; } }
          string IDataErrorInfo.this[string propertyName]
          {
              get { return this.GetValidationError(propertyName); }
          }
          public bool IsValid{get{ return ValidatedProperties.All(property => GetValidationError(property) == null); }}   
          static readonly string[] ValidatedProperties =
          {
              "FirstName"
          };
      
          private string GetValidationError(string propertyName)
          {
              string error = null;
              switch (propertyName)
              {
                  case "FirstName":
                      error = ValidateNames(FirstName, Lang.FirstName,3, 100);
                      break;         
      
              }
      
              return error;
          }
          private string ValidateNames(string name, string display, int min, int max)
          {
              if (String.IsNullOrWhiteSpace(name))
                  return string.Format(Lang.Required, display);
      
              if (name.Length < min || name.Length > max)
                  return string.Format(Lang.NumberLength, display, min, max);
      
              return null;
          }
     }


  5. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 19 Dec 2013 Link to this post

    Hello Ramon,

    Thank you for getting back to us. I can see that you're using a TextBox and a native validation approach, rather than a RadControl. This is why I believe it would help you to post your question in a general WPF programming forum.

    I found  a few links that you might find helpful:

    I hope these threads will help you move on.

    Regards,
    Tina Stancheva
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Ramon
    Ramon avatar
    11 posts
    Member since:
    Aug 2012

    Posted 21 Dec 2013 Link to this post

    hi
    I have used  Binaries.NoXaml and Themes.Implicit in the  WPF Application

    Telerik RadControls for WPF Q3 2013

    The DataModel implements IDataErrorInfo tried different implementation and the error still shows up
    Then even tried using  INotifyDataErrorInfo
    the error still shows.

    Using a a Textbox or a Telerik controller does not change a thing the error still shows.


     <telerik:RadDatePicker SelectedDate="{Binding User.DateOfBirth, Mode=TwoWay, NotifyOnValidationError=True,
                                            ValidatesOnDataErrors=True, ValidatesOnExceptions=True, UpdateSourceTrigger=PropertyChanged}"/>
               

    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:(no path); DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'PlacementTarget' (type 'UIElement')
    System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=Holder'. BindingExpression:Path=AdornedElement.(0)[0].ErrorContent; DataItem=null; target element is 'ToolTip' (Name='PART_ToolTip'); target property is 'Content' (type 'Object')


    If i change the style for validation the error goes away, so the error is in the Theme, not in the object.
    Regards
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 25 Dec 2013 Link to this post

    Hi,

    You say that If you change the style for validation the error goes away, but I do not see any definition the style you refer to.

    Would it be possible for you to isolate the issue in a demo project and send it to us?

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Ramon
    Ramon avatar
    11 posts
    Member since:
    Aug 2012

    Posted 06 Jan 2014 Link to this post

    Hi
    here is the ticketId: : 773523
    i upload the app once you run it you will see the error with the validation also, RadTimePicker is not displaying the error properly.
    Thank you

    Regards
  9. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 07 Jan 2014 Link to this post

    Hello Ramon,


    Thank you for getting back to us! Rather fortunately we have managed to immediately fixed this bug and the fix will be available with our very next internal build on Monday. 
    I'm currently updating your Telerik points accordingly! 


    Please excuse us for any inconvenience caused!


    Regards,
    Vanya Pavlova
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top
UI for WPF is Visual Studio 2017 Ready