How to bind to {Binding} and use converter

Lloyd Sheen 1,481 Reputation points
2022-09-06T14:14:45.283+00:00

I need to use a converter in Maui, the problem I am having is the XAML to which I using the converter can bind individually to properties but when I try to use it with just {Binding , convertername ---- I get an XAML parsing error.

The XAML that works is:
Text="{Binding Date, Converter={StaticResource DDC},ConverterParameter=0}"

Since I need other properties in the converter I want to change this to
Text="{Binding , Converter={StaticResource DDC},ConverterParameter=0}"

When I do that I get:
Severity Code Description Project File Line Suppression State
Error XFC0061 Error while parsing markup expression. DXMauiApp2 C:\Visual Stuido Stuff\Maui\DXMauiApp2\MainPage.xaml 360

Now if I use the only Binding without a converter it works so I am confused as to why it will not allow just the Binding as on occasion I have in testing used just the Binding to display what object type is being bound.

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,579 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Lloyd Sheen 1,481 Reputation points
    2022-09-06T14:23:38.36+00:00

    Found the answer:

    If I put spaces where there are none (after / before) commas then the error goes away

    XAML that works:

    Text="{Binding Converter={StaticResource DDC} , ConverterParameter=0}"

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.