Skip to content

Question: How to globally set breakpoints in C# code #5

@neilmispelaar

Description

@neilmispelaar

Hi there,

Is there an easy way that I am missing that could globally set the breakpoints (XS_SM, SM_MD, MD_LG) to different values?

The following code works, however, then I have to manually add the breakpoints to the XAML every time I use the ResponsiveGrid element.

<ge:ResponsiveGrid
        Breakpoints="400,600,800">
        ...
</ge:ResponsiveGrid>

My alternative was to create a local partial override class, however the XAML doesn't look very pretty:

    public partial class ResponsiveGridEx : ResponsiveGrid {          
        public ResponsiveGridEx() : base()
        {
            // Set the new breakpoints here 
            this.BreakPoints.XS_SM = (double)200;
            this.BreakPoints.SM_MD = (double)400;
            this.BreakPoints.MD_LG = (double)600;
        }
    }

However, the only issue with this is the XAML doesn't look very pretty as it has a namespace for local intermixed with the ge namespace

<local:ResponsiveGridEx>
        <Border ge:ResponsiveGrid.XS="12" ge:ResponsiveGrid.SM="3" ge:ResponsiveGrid.MD="1"/>
        <Border ge:ResponsiveGrid.XS="12" ge:ResponsiveGrid.SM="6" ge:ResponsiveGrid.MD="10"/>
        <Border ge:ResponsiveGrid.XS="12" ge:ResponsiveGrid.SM="3" ge:ResponsiveGrid.MD="1"/>
</local:ResponsiveGridEx>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions