Is there a way I can see the binding errors in while developing Xamarin Forms apps? The Application Output tab shows nothing but the binding doesn't work. How can I debug bindings?
0
votes
2 Answers
4
votes
I'd like to suggest you to add EmptyConverter
:
public class EmptyConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return value;
}
}
Then create instance of converter on your page:
<ContentPage.Resources>
<ResourceDictionary>
<converters:EmptyConverter x:Key="EmptyConverter"/>
</ResourceDictionary>
</ContentPage.Resources>
Then add converter to label:
<Label Text="{Binding Text, Converter={StaticResource EmptyConverter}}"/>
Put breakpoints in Convert
and ConvertBack
methods and you'll be able to see all changes of binded values.
Hope this will help you.
1
votes
You can try to use the Compiled Bindings: https://docs.microsoft.com/it-it/xamarin/xamarin-forms/app-fundamentals/data-binding/compiled-bindings
You will have gain performance and precise error reporting