Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
90
converting WebGrid -> WinGrid
posted

 Please Help Me

I Want Converting WinGrid...

===========WebGrid Source ========================================= 

e.DisplayLayout.AllowColumnMovingDefault = AllowColumnMoving.None;

e.DisplayLayout.ActivationObject.BorderStyle = BorderStyle.NotSet;

e.DisplayLayout.ActivationObject.BorderWidth = 1;

 e.DisplayLayout.CellClickActionDefault = CellClickAction.RowSelect;
 e.DisplayLayout.SelectTypeRowDefault = SelectType.Single;

 e.DisplayLayout.RowStyleDefault.Cursor = Infragistics.WebUI.Shared.Cursors.Hand;

e.DisplayLayout.StationaryMargins = Infragistics.WebUI.UltraWebGrid.StationaryMargins.Header;


e.DisplayLayout.ActivationObject.BorderColor = Color.FromName("#C1D4E4");

e.DisplayLayout.HeaderStyleDefault.CustomRules = @"font-family: ;font-size:12px;color:#28475D;background-color:#E4EEF7;text-align:center;height:20px;padding:1px;font-weight: normal;";

e.DisplayLayout.RowStyleDefault.CustomRules = @"font-family: ;font-size:12px;color:#667A88;background-color:#FAFDFF;height:20px;padding:1px";
 

e.DisplayLayout.RowAlternateStyleDefault.CustomRules = @"font-family: ;font-size:12px;color:#667A88;background-color:#F4FAFD;height:20px;padding:1px;";

 e.DisplayLayout.RowStyleDefault.BorderColor = Color.FromName("#C1D4E4");
 e.DisplayLayout.SelectedRowStyleDefault.BackColor = Color.FromName("#AFC1D3");
                    
                 

  • 2677
    posted

    Hello,

     Some of the properties do not directly map to the WinGrid, but I will do my best to answer what I can. 

    e.Layout.Override.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.NotAllowed;

    There is no activationObject.  See notes below; 

    e.Layout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.
    CellClickAction.RowSelect; e.Layout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single;

    e.Layout.Override.RowApperance.Cursor = System.Windows.Forms.Cursors.Hand;

    There is no stationaryMargins property.  By default, the WinGrid will give you a StationaryMargin Header effect.  It will not scroll. 

    For you Header Custom Rules, you can use the HeaderAppearance object. e.Layout.Override.HeaderAppearance.  You can find BackColor and Font etc.

    For your Alternate row custom rules, you can use the e.Layout.Override.RowAlternateAppearance object.  You can find BackColor and Font etc.

    For the RowStyle.BorderColor, you will have to set the RowAppearance and CellAppearance.                                e.Layout.Override.RowAppearance.BorderColor = Color.FromName("C1D4E4");                                         e.Layout.Override.CellAppearance.BorderColor = Color.FromName("C1D4E4");

    e.Layout.Override.SelectedRowAppearance.BackColor = Color.FromName("AFC1D3");

    You cant set the row Height via style anymore, so you can set the                                                                  e.Layout.Override.DefaultRowHeight = 20;

     Then, for the most complicated part, there is no activation object and no way to put a rectangle around the acive row.  So, we can use a DrawFilter to not draw the focus rectangle and to draw a border around the row.

    public bool DrawElement(DrawPhase drawPhase, ref UIElementDrawParams drawParams)

    {

    RowCellAreaUIElement rcauie = drawParams.Element as RowCellAreaUIElement;Rectangle r = new Rectangle(rcauie.Rect.X, rcauie.Rect.Y, rcauie.Rect.Width, rcauie.Rect.Height);

    r.Inflate(0, -1);

    drawParams.DrawBorders(UIElementBorderStyle.Solid, Border3DSide.All, Corners.None,Color.Blue, Color.Blue, r,r);

    return true;

    }

    public DrawPhase GetPhasesToFilter(ref UIElementDrawParams drawParams)

    {

    return DrawPhase.BeforeDrawFocus;

    }

     

    I hope this helps in the conversion of your WebGrid to WinGrid