Multibinding with Converter does not work

Hi support,
I have a listview populated with an observable collection and every property is displayed very well.

Now I do need a text which depends on two properties.
I want to use a multibinding converter for this.
My xaml is:

                        <Label Grid.Row="0" Grid.Column="2"

                            TextColor="{AppThemeBinding Light={StaticResource LightTimeTextColor}, Dark={StaticResource DarkTimeTextColor}}"

                            LineBreakMode="NoWrap"

                            VerticalOptions="Center"

                            FontSize="{OnPlatform iOS=44, Android=32}"

                            FontFamily="{OnPlatform iOS=HelveticaNeue-Thin, Android=monospace}"

                            >

                            <Label.Text>

                                <MultiBinding Converter="{StaticResource RaceTimeToStringConverter}">

                                    <Binding Path="RaceTime" />

                                    <Binding Path="RaceState" />

                                </MultiBinding>

                            </Label.Text>

                        </Label>


The problem is, that the converter receives an object with two values, but both of them are null.
If I use a single binding converter with either one of these properties, I do get the value without problems.

What can I do?

Regards, Stephan


3 Replies 1 reply marked as answer

RM RiyasHameed MohamedAbdulKhader Syncfusion Team July 12, 2023 06:17 AM UTC

Hi Stephan Schrade,


We have reviewed your reported query regarding “Multibinding with Converter does not work”. We observed that the converter receives null values for the first two to three calls (before binding was updated) and received proper values in converter. We recommend adding possible null checks for the values within the converter to avoid null exception crashing. To assist you further, we have prepared a video demonstration and a sample for your reference. Please let us know if you need any further assistance with this.

Regards,
Riyas Hameed M


Attachment: MultiBinding_e70c981b.zip

Marked as answer

SS Stephan Schrade July 12, 2023 08:17 PM UTC

Hi Riays,

many thanks for your quick reply.

It is a little bit strange what is going on here. Why is the converter called if there is no value available?

But anyway I now check the value that it is not null and now this works.

Regards,

Stephan



RM RiyasHameed MohamedAbdulKhader Syncfusion Team July 13, 2023 05:35 AM UTC

Stephan Schrade,

We are glad that the provided response meets your requirement. Please let us know if you need further assistance. As always, we are happy to help you out. 


Loader.
Up arrow icon