Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xamarin Forms Span preserve white space

How do I reserve a white space in a Formatted Text Label in Xamarin Forms I tried this but it doesn't seem to work

            <Label FontSize="Medium">
                <Label.FormattedText>
                    <FormattedString>
                        <Span xml:space="preserve">On PO: </Span>
                        <Span xml:space="preserve"> </Span>
                        <Span FontAttributes="Bold"  FontSize="Large" Text="{Binding Qty}"/>
                    </FormattedString>
                </Label.FormattedText>
            </Label>

I get this error

Error Position 22:35. No property, bindable property, or event found for 'space', or mismatching type between value and property.

like image 686
Joe B Avatar asked Oct 22 '18 18:10

Joe B


Video Answer


1 Answers

Use the text property of the span to give space.

 <Label FontSize="Medium">
            <Label.FormattedText>
                <FormattedString>
                    <Span Text="On PO: "/>
                    <Span Text=" "/>
                    <Span FontAttributes="Bold"  FontSize="Large" Text="{Binding Qty}"/>
                </FormattedString>
            </Label.FormattedText>
 </Label>
like image 134
Wasif Mahmood Mustafa Avatar answered Nov 13 '22 08:11

Wasif Mahmood Mustafa