We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

SfPopup Styles via Application Resources

Hi,

I'm having a hard time understanding the use of styles for the SfPopup component, so that I can have consistent looking pop ups by defining the style only once in my application resources file (App.xaml).

I have looked at your getting started pages, and the accompanying page on styles, but this only explains how to embed the style in every xaml page that uses a pop-up. I want to define this only once, but I'm sorry to say I am struggling.

I am temporarily using obvious colours here so I can see when my style is or isn't being used. Within my ResourceDictionary in App.xaml I have the following attempts at defining a style. I am unsure if I want a PopupStyle or a SfPopupLayout style.


I have attempted to use both of these as below



But at runtime when my popup is visible, none of the custom colours I defined seem to be being used. So although my styling and xaml is acceptable, it is not having any effect.

I seem to be spending far too long on something that I am sure should be simple once I have the correct syntax. I have searched your forum but have not found any similar posts on styling the popups via application resources.

Please could you point me in the direction of, or supply a suitable example of what I am trying to do?


Thanks

Paul


1 Reply

SV Suja Venkatesan Syncfusion Team January 20, 2023 02:20 PM UTC

Hi Paul Parkins,


Regarding “Implicit style defined for SfPopupLayout with key PopupLayoutStyle

 

As of now, we don’t support Implicit styles for SfPopupLayout, we considered this as a feature request. We have logged a feature request for the requirement “Support to apply styles to PopupView using implicit styles” in Xamarin.Forms and considered for implementation. We will implement this feature in any of our upcoming releases. When planning each release cycle, we review all open feature requests and prioritize them based on factors such as our product vision, technological feasibility, and customer interest. We will keep you updated on the status of this feature. You can also communicate with us regarding the open features at any time using our Feature Report page.     

 

Feedback link: https://www.syncfusion.com/feedback/9295/support-to-apply-styles-to-popupview-using-implicit-styles

 

If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal and cast your vote to make it count. 

 

Regarding “Explicit style defined as PopupStyle with key PopupViewStyle

To achieve an explicit style for SfPopupView as defined in your code snippet, assign the resource key to the PopupStyle property of SfPopupView, as shown in the following code example:

 

Code Snippets:

//App.XAML

<Application.Resources>

        <ResourceDictionary>

            <sfPopup:PopupStyle x:Key="popupstyle" HeaderBackgroundColor="Yellow"

                                    AcceptButtonTextColor="Red"

                                    HeaderTextColor="Purple"/>

        </ResourceDictionary>

    </Application.Resources>

 

//MainPage.XAML:

<sfPopup:SfPopupLayout.PopupView>

            <sfPopup:PopupView AppearanceMode="TwoButton"

                               AutoSizeMode="Height"

                               DeclineButtonText="Cancel"

                               HeaderTitle="Add New Board"

                               AcceptButtonText="Confirm"

                               PopupStyle="{StaticResource popupstyle}" >

               

            </sfPopup:PopupView>

        </sfPopup:SfPopupLayout.PopupView>


Regards,

Suja


Attachment: GettingStarted_8bf971ad.zip

Loader.
Up arrow icon