Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using DateTimePicker leads into error #3829

Closed
seba30 opened this issue May 29, 2020 · 2 comments · Fixed by #3830
Closed

Using DateTimePicker leads into error #3829

seba30 opened this issue May 29, 2020 · 2 comments · Fixed by #3830
Assignees
Labels
Milestone

Comments

@seba30
Copy link

seba30 commented May 29, 2020

Hey there,

With using the DateTimePicker, I get an error with the following message:

Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DatePicker', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'DatePickerTextBox' (Name='PART_TextBox'); target property is 'HelpText' (type 'String')

Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DatePicker', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'DatePickerTextBox' (Name='PART_TextBox'); target property is 'LabeledBy' (type 'UIElement')

Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DatePicker', AncestorLevel='1''. BindingExpression:Path=(0); DataItem=null; target element is 'DatePickerTextBox' (Name='PART_TextBox'); target property is 'Name' (type 'String')

A repository with the error can be found here.

MahApps.Metro: v2.0.0
Windows: Win10 1909 [Version 10.0.18363.836]
Visual Studio: 2019 16.6.0
Target Framework: v4.8

@seba30 seba30 added the Bug label May 29, 2020
@punker76 punker76 self-assigned this May 29, 2020
@punker76 punker76 added this to the 2.x.x milestone May 29, 2020
punker76 added a commit that referenced this issue May 29, 2020
We use a DatePickerTextBox inside the TimePickerBase which causes these errors with TargetFramework 4.8 and higher.
The DatePickerTextBox style uses triggers for UseNetFx472CompatibleAccessibilityFeatures, but the Bindings are looking for a DatePicker.
To fix this we added a new style for our DatePickerTextBox called MahApps.Styles.DatePickerTextBox.TimePickerBase.
punker76 added a commit that referenced this issue May 29, 2020
…472CompatibleAccessibilityFeatures

(GH-3829) Fix DateTimePicker BindingExpression errors
@punker76
Copy link
Member

@seba30 this has now been fixed, and it will be released in the next version of MahApps.Metro

@seba30
Copy link
Author

seba30 commented May 29, 2020

Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants