Can not bind Value with viewmodel property

How to bind the Barcode Value to the view model property?


<sfPopup:SfPopup xmlns="http://schemas.microsoft.com/dotnet/2021/maui"

                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"

                 x:Class="app.Views.PopupPage"

                 xmlns:barcode="clr-namespace:Syncfusion.Maui.Barcode;assembly=Syncfusion.Maui.Barcode"

                 xmlns:sfPopup="clr-namespace:Syncfusion.Maui.Popup;assembly=Syncfusion.Maui.Popup"

                 HeightRequest="350"

                 WidthRequest="400"

                 x:Name="sfPopup">

    <sfPopup:SfPopup.HeaderTemplate>

        <DataTemplate>

            <StackLayout>

                <Label Text="Print Label" HorizontalTextAlignment="Center"/>

            </StackLayout>

        </DataTemplate>

    </sfPopup:SfPopup.HeaderTemplate>


    <sfPopup:SfPopup.ContentTemplate>

        <DataTemplate>

            <StackLayout Spacing="5" Padding="5" BackgroundColor="White">

                <Label BackgroundColor="White" Text="Correspondence Sequence" HorizontalTextAlignment="Center"/>

                <Label BackgroundColor="White" Text="{Binding CorrespondenceDate}" HorizontalTextAlignment="Center"/>

                <barcode:SfBarcodeGenerator x:Name="brc" Value="{Binding CorrespondenceSequnce}"

                                ShowText="True"

                                HeightRequest="150">


                    <barcode:SfBarcodeGenerator.Symbology>

                        <barcode:Codabar Module="2" />

                    </barcode:SfBarcodeGenerator.Symbology>

                </barcode:SfBarcodeGenerator>

                <Button Text="Print" Command="{Binding PrintLabelCommand}" HorizontalOptions="Center"/>

            </StackLayout>

        </DataTemplate>

    </sfPopup:SfPopup.ContentTemplate>


</sfPopup:SfPopup>


2 Replies

DS david schneider October 13, 2025 08:53 PM UTC

Binding isn't working for me either in the sfpopup.  I have another control in the same view and it binds properly, but the sfpopup flags all bindings as "unable to resolve symbol".  At runtime I get a null reference exception that I assume is somewhere in snycfusion trying to use the unresolved the binding.  



VM Vidyalakshmi Mani Syncfusion Team October 14, 2025 02:10 PM UTC

Hi Fahad,


Thank you for reaching out to us. We’ve reviewed the issue you reported and found that it occurs at the sample level. To resolve the problem you’re experiencing, please ensure that the binding context for the popup page is set correctly, as shown below.


 

<sfPopup:SfPopup xmlns="http://schemas.microsoft.com/dotnet/2021/maui" 

                 xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 

                 x:Class="GettingStarted.PopupPage" 

                 xmlns:barcode="clr-namespace:Syncfusion.Maui.Barcode;assembly=Syncfusion.Maui.Barcode" 

                 xmlns:sfPopup="clr-namespace:Syncfusion.Maui.Popup;assembly=Syncfusion.Maui.Popup" 

                 xmlns:local="clr-namespace:GettingStarted" 

                 HeightRequest="350" 

                 WidthRequest="400" 

                 x:Name="sfPopup"> 

 

    <sfPopup:SfPopup.BindingContext> 

        <local:ViewModel /> 

    </sfPopup:SfPopup.BindingContext> 

 

    <sfPopup:SfPopup.HeaderTemplate> 

        <DataTemplate> 

            <StackLayout> 

                <Label Text="Print Label" 

                       HorizontalTextAlignment="Center" /> 

            </StackLayout> 

        </DataTemplate> 

    </sfPopup:SfPopup.HeaderTemplate> 

 

    <sfPopup:SfPopup.ContentTemplate> 

        <DataTemplate> 

            <StackLayout Spacing="5" 

                         Padding="5" 

                         BackgroundColor="White"> 

                <Label BackgroundColor="White" 

                       Text="Correspondence Sequence" 

                       HorizontalTextAlignment="Center" />

 

                <Label BackgroundColor="White"

                       Text="{Binding CorrespondenceDate}"

                       HorizontalTextAlignment="Center" />

 

                <barcode:SfBarcodeGenerator x:Name="brc"

                                            Value="{Binding CorrespondenceSequnce}"

                                            ShowText="True"

                                            HeightRequest="150">

 

                </barcode:SfBarcodeGenerator>

 

                <Button Text="Print" 

                        HorizontalOptions="Center" /> 

 

            </StackLayout> 

        </DataTemplate> 

    </sfPopup:SfPopup.ContentTemplate> 

</sfPopup:SfPopup>

 


We’ve also prepared a simple sample demonstrating this approach. Please review the attached sample, and let us know if you need any further assistance.


Regards,

Vidyalakshmi M.



Attachment: GettingStarted_d6588695.zip

Loader.
Up arrow icon