sourcechord / GridExtra

Custom panel controls for WPF/UWP.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question: How to globally set breakpoints in C# code

neilmispelaar opened this issue · comments

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>