• Sorting GroupByRows in the WinGrid by the Number of Child Rows

    Introduction

    Using OutlookGroupBy, UltraWinGrid allows you to group rows with similar values together just like Microsoft Outlook.

    The way grouping works is that the grid will sort the column and then loop through the rows to find matching values. Thus, the GroupByRows are sorted in the same order in which the value of the column are sorted. For example, if the column contains string data, then the rows of the grid…

    • Thu, Jul 2 2009
  • Creating a dropdown list in a grid cell whose list values are dependent on another cell

    Introduction

    The UltraGridColumn has a ValueList property which allows you to attach a dropdown list to the column. The dropdown list may be any class that implements the IValueList interface, which includes the ValueList, BindableValueList, or UltraDropDown.

    But suppose you want the list in a cell to change based on some other data in the row. For example, let’s say you have a grid populated with a list of customers…

    • Fri, May 8 2009
  • Make an WinGrid Cell Containing an WinTextEditor Read-Only

    If the WinTextEditor is set to the EditorControl of a single cell, in order to make it read- only the cell’s Activation property needs to be set to “ActivateOnly.”

    The following code and samples assume the WinTextEditor is the EditorControl of an entire column in the WinGrid.

    C#

    private void ultraGrid1_InitializeLayout(object sender, 
        Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs…
    • Sat, Feb 28 2009
  • Turn off the WinGrid ActiveRowAppearance

    When you place a new UltraWinGrid on a form, it loads a default Preset. This preset applies an ActiveRowAppearance and an ActiveCellAppearance to the grid which make the ActiveRow appear with the same colors as a selected row.

    Note that this behavior does not affect selection in any way. To control row selection in the grid, you should use the SelectTypeRow property on the Override. To turn off this appearance on the…

    • Sat, Feb 28 2009
  • Determine WinGrid Mouse Position and Cell Identification

    Many projects using the WinGrid for navigation need to be able to determine which cell the user clicked on without the cell being selected or becoming active.  Using the grid's MouseUp or MouseDown events, you can retrieve a reference to the UIElement for the mouse point, retrieve a reference to the Cell, and if the Cell reference is not Nothing display the Band and Column Key.

    Dim aUIElement As Infragistics.Win…
    • Sat, Feb 28 2009
  • Activating a Cell for Edit Mode in UltraGrid

    When using a BindingNavigator in conjuction with UltraGrid, at runtime, the BindingNavigator's "Add" button is clicked a row is added and the grid moves to the new row. 

    To set the cell to edit via its fieldname, and automatically put the cell in edit mode, use this code: 

    private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) 
      {   
        this.ultraGrid1.Rows[this.ultraGrid1.Rows…
    • Sat, Feb 28 2009
  • Set AppStylist Font at Runtime

    If you do not want hard code the font name in an AppStylist ISL file and instead determine it at runtime and set this value in code. 

    private void ultraFontNameEditor1_ValueChanged(object sender, EventArgs e)
    {
        ApplicationStyleLibrary styleLibrary = new ApplicationStyleLibrary();
        styleLibrary.LoadFromStyleManager();
    
        StyleSetSettings styleSet = null;
        if (styleLibrary.StyleSets.Count > 0 && styleLibrary…
    • Sat, Feb 28 2009
  • Determine the Font & Point Size at Runtime When Using AppStylist

    At runtime, when checking the Font property of the UltraLabel, it returns the default font that the control renders with.  When the text actually drawn on the control, it is using the correct font specified in the AppStylist ISL file.  The result of this is that the measurements are incorrect, and the text gets clipped because the window is sized incorrectly.

    The reason for this is that the controls try not to create…

    • Sat, Feb 28 2009
  • Changing Foreign Key using LINQ to SQL and UltraCombo

    Scenario:

    1. You are using a ultraComboEditor on a detailview showing an order object.
    2. You using Linq for Sql, and I am having a Order and a OrderState objects that I would like to bind together.

     

    On the detailView for the Order object I would like to have an UltraComboEditor, in which it is possible to set the state of the order. The datasource of the UltraComboEditor would be a bindingSource containing OrderState…

    • Sat, Feb 28 2009
  • Automatically Set the Height on a Fixed-Width UltraLabel

    If you set AutoSize = true on an UltraLabel, its height becomes fixed and its width expands/collapses to accommodate its text.  So how can you fix its width and have the UltraLabel autosize its height to accommodate the height of the wrapped text?

    Since the control doesn't natively support this, you can derive a control from UltraLabel and override the constructor and set AutoSizeHeightOnly to true.

    class UltraLabelWithAutoHeight…
    • Sat, Feb 28 2009