data binding - WPF - Cannot convert '<null>' from type '<null>' to type 'System.Uri' -
I have a simple user control to display hyperlinks in the text block:
LinkTextBlock.xaml:
& lt; TextBlock & gt; & Lt; Hyperlink navigatry = "{binding url, element = route}" & gt; & Lt; Text block text = "{binding text, element = route}" /> & Lt; / Hyperlink & gt; & Lt; / TextBlock & gt; LinkTextBlock.xaml.cs:
Public static readonly dependency property UrlProperty = DependencyProperty.Register ("URL", typef (string), typef (LinkTextBlock )); Public string url {get {return (string) GetValue (UrlProperty); } Set {set value (url property, value); }} Public Dept. only dependent form for reading static TextProperty = DependencyProperty.Register ("text", typef (string), typef (LinkTextBlock)); Public string text {get {return (string) GetValue (TextProperty); } Set {set value (textproperty, value); }}
Then, I have a datatapplet for a list box:
& lt; Control: Link Text Block Text = "{Binding Email}" URL = "{Binding Email}" />
When I run the application, it works perfectly. Control shows hyperlink in the right way and there is no clear problem. However, when I look I see the output window I get an exception for each list box item,
System.Windows.Data error: 22 "from type to type ' 'System' can not change 'Yuri' for N-US culture 'with default conversion; Consider using binding converter property. NotSupportedException: 'System.NotSupportedException: UriTypeConverter can not change from System.ComponentModel.TypeConverter.GetConvertFromException (Object Value) on System.ComponentModel.TypeConverter.ConvertFrom (ITypeDescriptorContext Reference, CultureInfo Culture, Object Value) on system. Yuri type converters. Knwartfom (ITypeDescriptorContext context, CultureInfo culture, object value) Type Data.DefaultValueConverter.ConvertHelper (Object o, Type destination MS.Internal, dependency object target Element, Kalcrinfo culture, Boolean Forward) '
Why is this happening? I know that the binding error is a result of compelling Navigaiti Do you have any suggestions for me? What can I do about it? I really appreciate your input.
Thank you
I got it in Uri problem occurs when the string is an implicit conversion, because Nevigetiri type Uri I need a converter to convert the Uri string is, change its property in Uri string, and it worked fine all without exception.
Comments
Post a Comment