Touch Enabled Scenarios with Infragistics Windows Forms Components

[Infragistics] Mihail Mateev / Tuesday, April 28, 2015

Infragistics Windows Form controls offer opportunities to cover different scenarios and represent data in your desktop applications. This toolkit is one of the best, most extensible third party controls that I have ever used for UI development. With more than 100+ controls, Infragistics Windows Forms is the most mature, fully-featured Windows Forms Product on the market. With features that cover every aspect of enterprise software development including Microsoft Office Style user interfaces, high performance charting, and full modern experiences with touch gestures, these controls were built to empower you to create Touch-Enabled, Office Inspired Apps on Every Platform.

In this article we will discuss some common scenarios when you need to have touch support and then we'll explore some useful examples of how to implement it.

Touch Enabled Concept

Prior to Windows 7, Windows Forms controls did not natively support gestures of user interaction with a touch input digitizer surface through managed code. You may administer Windows7 supported WM_GESTURE message in unmanaged code to provide support for the recognized Windows gestures.

One well-known gesture, kinetic scrolling with inertia (also referred to as touch panning) occurs when the user drags a finger across a touch surface, with the speed and direction of the movement determining the direction of and speed at which the window scrolls. The scrolling continues, even after the user withdrawals his or her finger, gradually decelerating before coming to a complete stop, a behavior known as panning inertia. Any user interaction occurring during this deceleration immediately stops the inertial panning. This behavior is prevalent on smart phones and tablet devices such as iPhone, iPad and Windows touch-enabled Surface devices.

Another application of the panning gesture is drag selection, where the user drags a lasso around the screen, selecting any items captured within the bounds of the lasso rectangle.

Other gestures also have default behaviors associated with them, for example, displaying a context menu using a press-and-hold gesture. This is where the user holds a finger down on the touch surface without moving it and displays a context menu after a short time.

What you need to know

The size of the Infragistics Windows Forms touch-enabled controls may be the first thing you notice. By design, touch-enabled controls appear larger (wider, taller or both) than buttons and other elements in the User Interface (UI) making it easier to interact with and operate when using a touch-sensitive surface.

Enabling the touch functionality occurs at the form level rather than the control level, as it is unlikely that both Touch and Non-Touch system use the same application. Adding the UltraTouchProvider component to the form enables Form level touch support for NetAdvantage controls.

Although other approaches were analyzed for enabling Touch functionality at the application level, none appeared to be a feasible solution allowing you to interact with the touch metrics at design-time to arrange controls on the form using the designer. The only way to enable touch at the application level is via the static property. Since the static property is not available at design-time, best practice dictates enabling the touch functionality at the Form level.

Touch Support Controls

 

 

 

 

Touch Experience

Touch Metric Suport

Resize elements of the Grid, Editor, List View, Tree, Tab, and Tabbed MDI controls to make them larger for better touch interactivity.

 

Panning Gesture Support

The Grid, Tree, and List View controls are enabled with support for panning gestures, including vertical, slow, fast, and multi-directional panning and flicking. Additionally the Combo, Combo Editor, and Value List support vertical scrolling via the panning gesture.

Multi-Gesture Support

The Grid, Tree, and List View controls support key multi-gesture functionality, including tap, tap & drag, double tap, and tap & hold.

 

 

Code Samples

Touch Tab Controls

 

 1: using System;
 2: using System.Globalization;
 3: using System.Windows.Forms;
 4: using Infragistics.Win;
 5: using Infragistics.Win.UltraWinTabControl;
 6: using Infragistics.Win.UltraWinTabs;
 7:  
 8: namespace TouchEnabledTabControls.CS
 9: {
 10:     public partial class TabControlsForm : Form
 11:     {
 12:         #region Constructor
 13:         public TabControlsForm()
 14:         {
 15:             InitializeComponent();
 16:         } 
 17:         #endregion
 18:  
 19:         #region TabControlsFormLoad
 20:         private void TabControlsFormLoad(object sender, EventArgs e)
 21:         {
 22:             // Set the ComboEditors with default display value.
 23:             ultraComboEditor_Tab_ScrollButtons.SelectedIndex = 2;
 24:             ultraComboEditor_Tab_CloseButtons.SelectedIndex = 1;
 25:             ultraComboEditor_Tab_Style.SelectedIndex = 0;
 26:  
 27:             ultraComboEditor_TabStrip_ScrollButtons.SelectedIndex = 2;
 28:             ultraComboEditor_TabStrip_CloseButtons.SelectedIndex = 1;
 29:             ultraComboEditor_TabStrip_Style.SelectedIndex = 0;
 30:         } 
 31:         #endregion
 32:  
 33:         #region BtnEnableTouchClick
 34:         private void BtnEnableTouchClick(object sender, EventArgs e)
 35:         {
 36:             ultraTouchProvider1.Enabled = !ultraTouchProvider1.Enabled;
 37:             btnEnableTouch.Text = ultraTouchProvider1.Enabled ? Properties.Resources.Button_Disable_Touch : Properties.Resources.Button_Enable_Touch;
 38:         }
 39:         #endregion
 40:  
 41:         #region WinTab Control events
 42:  
 43:         #region UltraComboEditorTabScrollButtonValueChanged
 44:         // Show Scroll Buttons
 45:         private void UltraComboEditorTabScrollButtonValueChanged(object sender, EventArgs e)
 46:         {
 47:             var cb = ultraComboEditor_Tab_ScrollButtons;
 48:             if (cb == null || cb.SelectedItem == null)
 49:                 return;
 50:  
 51:             var item = cb.SelectedItem.DisplayText;
 52:  
 53:             switch (item)
 54:             {
 55:                 case "Default":
 56:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.Default;
 57:                     break;
 58:                 case "FirstLast":
 59:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.FirstLast;
 60:                     break;
 61:                 case "NextPrevious":
 62:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.NextPrevious;
 63:                     break;
 64:                 case "NextPagePreviousPage":
 65:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.NextPagePreviousPage;
 66:                     break;
 67:                 case "None":
 68:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.None;
 69:                     break;
 70:                 case "Thumb":
 71:                     ultraTabControl1.ScrollButtonTypes = ScrollButtonTypes.Thumb;
 72:                     break;
 73:             }
 74:         }
 75:         #endregion
 76:  
 77:         #region UltraComboEditorTabCloseButtonValueChanged
 78:         // Show Close Buttons
 79:         private void UltraComboEditorTabCloseButtonValueChanged(object sender, EventArgs e)
 80:         {
 81:             var cb = ultraComboEditor_Tab_CloseButtons;
 82:             if (cb == null || cb.SelectedItem == null)
 83:                 return;
 84:             ultraTabControl1.CloseButtonLocation = (TabCloseButtonLocation)cb.SelectedIndex;
 85:         }
 86:         #endregion
 87:  
 88:         #region UltraComboEditorTabStyleValueChanged
 89:         // Select a Style (NotePage)
 90:         private void UltraComboEditorTabStyleValueChanged(object sender, EventArgs e)
 91:         {
 92:             var cb = ultraComboEditor_Tab_Style;
 93:             if (cb == null || cb.SelectedItem == null)
 94:                 return;
 95:  
 96:             var item = cb.SelectedItem.DisplayText;
 97:  
 98:             switch (item)
 99:             {
 100:                 case "Default":
 101:                     ultraTabControl1.Style = UltraTabControlStyle.Default;
 102:                     break;
 103:                 case "NotePage":
 104:                     ultraTabControl1.Style = UltraTabControlStyle.NotePage;
 105:                     break;
 106:                 case "NotePageFlat":
 107:                     ultraTabControl1.Style = UltraTabControlStyle.NotePageFlat;
 108:                     break;
 109:             }
 110:         }
 111:         #endregion
 112:  
 113:         #region UltraCheckEditorTabShowListButtonCheckedChanged
 114:         // Show TabList button
 115:         private void UltraCheckEditorTabShowListButtonCheckedChanged(object sender, EventArgs e)
 116:         {
 117:             ultraTabControl1.ShowTabListButton =
 118:                 ultraTabControl1.ShowTabListButton != DefaultableBoolean.True ? DefaultableBoolean.True : DefaultableBoolean.Default;
 119:         }
 120:         #endregion
 121:  
 122:         #endregion
 123:  
 124:         #region WinTabStrip Control events
 125:  
 126:         #region UltraComboEditorTabStripScrollButtonValueChanged
 127:         // Show Scroll Buttons
 128:         private void UltraComboEditorTabStripScrollButtonValueChanged(object sender, EventArgs e)
 129:         {
 130:             var cb = ultraComboEditor_TabStrip_ScrollButtons;
 131:             if (cb == null || cb.SelectedItem == null)
 132:                 return;
 133:  
 134:             var item = cb.SelectedItem.DisplayText;
 135:  
 136:             switch (item)
 137:             {
 138:                 case "Default":
 139:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.Default;
 140:                     break;
 141:                 case "FirstLast":
 142:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.FirstLast;
 143:                     break;
 144:                 case "NextPrevious":
 145:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.NextPrevious;
 146:                     break;
 147:                 case "NextPagePreviousPage":
 148:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.NextPagePreviousPage;
 149:                     break;
 150:                 case "None":
 151:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.None;
 152:                     break;
 153:                 case "Thumb":
 154:                     ultraTabStripControl1.ScrollButtonTypes = ScrollButtonTypes.Thumb;
 155:                     break;
 156:             }
 157:         } 
 158:         #endregion
 159:  
 160:         #region UltraComboEditorTabStripCloseButtonValueChanged
 161:         // Show Close Buttons
 162:         private void UltraComboEditorTabStripCloseButtonValueChanged(object sender, EventArgs e)
 163:         {
 164:             var cb = ultraComboEditor_TabStrip_CloseButtons;
 165:             if (cb == null || cb.SelectedItem == null)
 166:                 return;
 167:             ultraTabStripControl1.CloseButtonLocation = (TabCloseButtonLocation)cb.SelectedIndex;
 168:         } 
 169:         #endregion
 170:  
 171:         #region UltraComboEditorTabStripStyleValueChanged
 172:         // Select a Style (NotePage)
 173:         private void UltraComboEditorTabStripStyleValueChanged(object sender, EventArgs e)
 174:         {
 175:             var cb = ultraComboEditor_TabStrip_Style;
 176:             if (cb == null || cb.SelectedItem == null)
 177:                 return;
 178:  
 179:             var item = cb.SelectedItem.DisplayText;
 180:  
 181:             switch (item)
 182:             {
 183:                 case "Default":
 184:                     ultraTabStripControl1.Style = UltraTabControlStyle.Default;
 185:                     break;
 186:                 case "NotePage":
 187:                     ultraTabStripControl1.Style = UltraTabControlStyle.NotePage;
 188:                     break;
 189:                 case "NotePageFlat":
 190:                     ultraTabStripControl1.Style = UltraTabControlStyle.NotePageFlat;
 191:                     break;
 192:             }
 193:         } 
 194:         #endregion
 195:  
 196:         #region UltraCheckEditorTabStripShowListButtonCheckedChanged
 197:         // Show TabList button
 198:         private void UltraCheckEditorTabStripShowListButtonCheckedChanged(object sender, EventArgs e)
 199:         {
 200:             ultraTabStripControl1.ShowTabListButton =
 201:                 ultraTabStripControl1.ShowTabListButton != DefaultableBoolean.True ? DefaultableBoolean.True : DefaultableBoolean.Default;
 202:         } 
 203:         #endregion
 204:  
 205:         #region UltraTabStripControl1TabStripSelectedTabChanged
 206:         // Selected Tab Changed event
 207:         private void UltraTabStripControl1TabStripSelectedTabChanged(object sender, SelectedTabChangedEventArgs e)
 208:         {
 209:             var num = e.Tab.Index + 1;
 210:             ultraTextEditor_TabStrip.Text = num.ToString(CultureInfo.InvariantCulture);
 211:         }
 212:         #endregion 
 213:  
 214:         #endregion
 215:     }
 216: }

Touch Editors And Grid Elements

 1: using System;
 2: using System.Windows.Forms;
 3: using Infragistics.Win;
 4: using Infragistics.Win.UltraWinEditors;
 5: using System.Drawing;
 6: using Infragistics.Win.UltraWinGrid;
 7: using ButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle;
 8:  
 9: namespace TouchEnabledEditorsAndGridElements.CS
 10: {
 11:     public partial class TouchForm : Form
 12:     {
 13:         #region Constructor
 14:         public TouchForm()
 15:         {
 16:             InitializeComponent();
 17:         } 
 18:         #endregion
 19:  
 20:         #region TouchFormLoad
 21:         private void TouchFormLoad(object sender, EventArgs e)
 22:         {
 23:             // Bind UltraCombo.
 24:             ultraCombo.DataSource = new TestData();
 25:             ultraCombo.SelectedText = "Select Item";
 26:  
 27:  
 28:             // Bind UltraComboEditor.
 29:             ultraComboEditor.DataSource = new TestData();
 30:             ultraComboEditor.SelectedIndex = 1;
 31:  
 32:  
 33:             // Bind WinGrid.
 34:             ultraGrid1.DataSource = new TestData();
 35:  
 36:  
 37:             // Display difault values in ComboEditors.
 38:             ultraComboEditor_SelectCardViewStyle.SelectedIndex = 0;
 39:             ultraComboEditor_FixedRowIndicator.SelectedIndex = 1;
 40:             ultraComboEditor_EnableSummary.SelectedIndex = 3;
 41:  
 42:  
 43:             // Attach DrawFilter (RemoveFocusRectangle) to CheckEditor.
 44:             // This will prevent from displaying the dotted line when the control is clicked.
 45:             ultraCheckEditor.DrawFilter = new RemoveFocusRectangle();
 46:             ultraTabControl1.DrawFilter = new RemoveFocusRectangle();
 47:             ultraOptionSet.DrawFilter = new RemoveFocusRectangle();
 48:         } 
 49:         #endregion
 50:  
 51:         #region Editor Controls
 52:  
 53:         // Add/Remove Buttons LEFT / RIGHT
 54:         private void UltraCheckEditorAddButtonRightLeftCheckedChanged(object sender, EventArgs e)
 55:         {
 56:             var button1 = new EditorButton();
 57:  
 58:             // Add /Remove LEFT button
 59:             if (ultraCalculatorDropDown.ButtonsLeft.Count < 1)
 60:             {
 61:                 ultraCalculatorDropDown.ButtonsLeft.Add(button1);
 62:                 ultraColorPicker.ButtonsLeft.Add(button1);
 63:                 ultraCombo.ButtonsLeft.Add(button1);
 64:                 ultraComboEditor.ButtonsLeft.Add(button1);
 65:                 ultraCurrencyEditor.ButtonsLeft.Add(button1);
 66:                 ultraDateTimeEditor.ButtonsLeft.Add(button1);
 67:                 ultraFontNameEditor.ButtonsLeft.Add(button1);
 68:                 ultraFormattedTextEditor.ButtonsLeft.Add(button1);
 69:                 ultraMaskedEdit.ButtonsLeft.Add(button1);
 70:                 ultraNumericEditor.ButtonsLeft.Add(button1);
 71:                 ultraTextEditor.ButtonsLeft.Add(button1);
 72:                 ultraTimeSpanEditor.ButtonsLeft.Add(button1);
 73:                 ultraTimeZoneEditor.ButtonsLeft.Add(button1);
 74:             }
 75:             else
 76:             {
 77:                 ultraCalculatorDropDown.ButtonsLeft.RemoveAt(0);
 78:                 ultraColorPicker.ButtonsLeft.RemoveAt(0);
 79:                 ultraCombo.ButtonsLeft.RemoveAt(0);
 80:                 ultraComboEditor.ButtonsLeft.RemoveAt(0);
 81:                 ultraCurrencyEditor.ButtonsLeft.RemoveAt(0);
 82:                 ultraDateTimeEditor.ButtonsLeft.RemoveAt(0);
 83:                 ultraFontNameEditor.ButtonsLeft.RemoveAt(0);
 84:                 ultraFormattedTextEditor.ButtonsLeft.RemoveAt(0);
 85:                 ultraMaskedEdit.ButtonsLeft.RemoveAt(0);
 86:                 ultraNumericEditor.ButtonsLeft.RemoveAt(0);
 87:                 ultraTextEditor.ButtonsLeft.RemoveAt(0);
 88:                 ultraTimeSpanEditor.ButtonsLeft.RemoveAt(0);
 89:                 ultraTimeZoneEditor.ButtonsLeft.RemoveAt(0);
 90:             }
 91:  
 92:             var button2 = new EditorButton();
 93:  
 94:             // Add /Remove RIGHT button
 95:             if (ultraCalculatorDropDown.ButtonsRight.Count < 1)
 96:             {
 97:                 ultraCalculatorDropDown.ButtonsRight.Add(button2);
 98:                 ultraColorPicker.ButtonsRight.Add(button2);
 99:                 ultraCombo.ButtonsRight.Add(button2);
 100:                 ultraComboEditor.ButtonsRight.Add(button2);
 101:                 ultraCurrencyEditor.ButtonsRight.Add(button2);
 102:                 ultraDateTimeEditor.ButtonsRight.Add(button2);
 103:                 ultraFontNameEditor.ButtonsRight.Add(button2);
 104:                 ultraFormattedTextEditor.ButtonsRight.Add(button2);
 105:                 ultraMaskedEdit.ButtonsRight.Add(button2);
 106:                 ultraNumericEditor.ButtonsRight.Add(button2);
 107:                 ultraTextEditor.ButtonsRight.Add(button2);
 108:                 ultraTimeSpanEditor.ButtonsRight.Add(button2);
 109:                 ultraTimeZoneEditor.ButtonsRight.Add(button2);
 110:             }
 111:             else
 112:             {
 113:                 ultraCalculatorDropDown.ButtonsRight.RemoveAt(0);
 114:                 ultraColorPicker.ButtonsRight.RemoveAt(0);
 115:                 ultraCombo.ButtonsRight.RemoveAt(0);
 116:                 ultraComboEditor.ButtonsRight.RemoveAt(0);
 117:                 ultraCurrencyEditor.ButtonsRight.RemoveAt(0);
 118:                 ultraDateTimeEditor.ButtonsRight.RemoveAt(0);
 119:                 ultraFontNameEditor.ButtonsRight.RemoveAt(0);
 120:                 ultraFormattedTextEditor.ButtonsRight.RemoveAt(0);
 121:                 ultraMaskedEdit.ButtonsRight.RemoveAt(0);
 122:                 ultraNumericEditor.ButtonsRight.RemoveAt(0);
 123:                 ultraTextEditor.ButtonsRight.RemoveAt(0);
 124:                 ultraTimeSpanEditor.ButtonsRight.RemoveAt(0);
 125:                 ultraTimeZoneEditor.ButtonsRight.RemoveAt(0);
 126:             }
 127:         }
 128:  
 129:  
 130:         // Add/Remove Spin button
 131:         private void UltraCheckEditorAddSpinButtonCheckedChanged(object sender, EventArgs e)
 132:         {
 133:             //var spinButton = new SpinEditorButton { Orientation = Orientation.Horizontal };
 134:  
 135:             // Add /Remove SPIN button
 136:             ultraCurrencyEditor.SpinButtonDisplayStyle =
 137:                 ultraCurrencyEditor.SpinButtonDisplayStyle != ButtonDisplayStyle.Always
 138:                 ? ButtonDisplayStyle.Always
 139:                 : ButtonDisplayStyle.Never;
 140:  
 141:             ultraDateTimeEditor.SpinButtonDisplayStyle =
 142:                 ultraDateTimeEditor.SpinButtonDisplayStyle != ButtonDisplayStyle.Always
 143:                 ? ButtonDisplayStyle.Always
 144:                 : ButtonDisplayStyle.Never;
 145:  
 146:             ultraMaskedEdit.SpinButtonDisplayStyle =
 147:                 ultraMaskedEdit.SpinButtonDisplayStyle == SpinButtonDisplayStyle.None
 148:                 ? SpinButtonDisplayStyle.OnRight
 149:                 : SpinButtonDisplayStyle.None;
 150:  
 151:             ultraNumericEditor.SpinButtonDisplayStyle =
 152:                 ultraNumericEditor.SpinButtonDisplayStyle != ButtonDisplayStyle.Always
 153:                 ? ButtonDisplayStyle.Always
 154:                 : ButtonDisplayStyle.Never;
 155:         }
 156:  
 157:  
 158:         // Change the color of RadioButton's label
 159:         private void UltraOptionSetValueChanged(object sender, EventArgs e)
 160:         {
 161:             ultraLabel_UltraOptionSet.ForeColor = ultraOptionSet.CheckedItem.DataValue.ToString()
 162:                 == "Red" ? Color.Red : Color.Blue;
 163:         }
 164:  
 165:  
 166:         // Display the selected font on the label in front of the control
 167:         private void UltraFontNameEditorValueChanged(object sender, EventArgs e)
 168:         {
 169:             ultraLabel_UltraFontNameEditor.Appearance.FontData.Name = ultraFontNameEditor.Value.ToString();
 170:         } 
 171:         #endregion
 172:  
 173:         #region WinGrid Elements events
 174:         // Enable/Disable Row filters
 175:         private void UltraCheckEditorRowFilteringCheckedChanged(object sender, EventArgs e)
 176:         {
 177:             ultraGrid1.DisplayLayout.Override.AllowRowFiltering =
 178:                 ultraGrid1.DisplayLayout.Override.AllowRowFiltering != DefaultableBoolean.True
 179:                 ? DefaultableBoolean.True
 180:                 : DefaultableBoolean.False;
 181:         }
 182:  
 183:  
 184:         // Enable/Desable Fixed header indicator
 185:         private void UltraCheckEditorEnableFixedHeaderCheckedChanged(object sender, EventArgs e)
 186:         {
 187:             ultraGrid1.DisplayLayout.UseFixedHeaders =
 188:                 ultraGrid1.DisplayLayout.UseFixedHeaders != true;
 189:         }
 190:  
 191:  
 192:         // Enable/Desable Row selectors
 193:         private void UltraCheckEditorEnableRowSelectorsCheckedChanged(object sender, EventArgs e)
 194:         {
 195:             ultraGrid1.DisplayLayout.Bands[0].Override.RowSelectors =
 196:                 ultraGrid1.DisplayLayout.Bands[0].Override.RowSelectors != DefaultableBoolean.Default
 197:                     ? DefaultableBoolean.Default
 198:                     : DefaultableBoolean.False;
 199:         }
 200:  
 201:  
 202:         // Enable/Desable header CheckBox
 203:         private void UltraCheckEditorEnableHeaderCheckBoxCheckedChanged(object sender, EventArgs e)
 204:         {
 205:             ultraGrid1.DisplayLayout.Override.HeaderCheckBoxVisibility =
 206:                 ultraGrid1.DisplayLayout.Override.HeaderCheckBoxVisibility != HeaderCheckBoxVisibility.Always
 207:                     ? HeaderCheckBoxVisibility.Always
 208:                     : HeaderCheckBoxVisibility.Default;
 209:         }
 210:  
 211:  
 212:         // Enable/Desable Filter Operator on the FilterRow.
 213:         private void UltraCheckEditorEnableFilterOperatorCheckedChanged(object sender, EventArgs e)
 214:         {
 215:             ultraGrid1.DisplayLayout.Override.FilterUIType =
 216:                ultraGrid1.DisplayLayout.Override.FilterUIType != FilterUIType.FilterRow
 217:                    ? FilterUIType.FilterRow
 218:                    : FilterUIType.Default;
 219:         }
 220:  
 221:  
 222:         // Enable/Desable Column chooser
 223:         private void UltraCheckEditorEnableColumnChooserCheckedChanged(object sender, EventArgs e)
 224:         {
 225:             ultraGrid1.DisplayLayout.Override.RowSelectorHeaderStyle =
 226:                 ultraGrid1.DisplayLayout.Override.RowSelectorHeaderStyle != RowSelectorHeaderStyle.ColumnChooserButton
 227:                     ? RowSelectorHeaderStyle.ColumnChooserButton
 228:                     : RowSelectorHeaderStyle.Default;
 229:         }
 230:  
 231:  
 232:         // Enable/Desable column Swapping
 233:         private void UltraCheckEditorEnableColumnSwappingCheckedChanged(object sender, EventArgs e)
 234:         {
 235:             ultraGrid1.DisplayLayout.Override.AllowColSwapping =
 236:                 ultraGrid1.DisplayLayout.Override.AllowColSwapping != AllowColSwapping.WithinBand
 237:                     ? AllowColSwapping.WithinBand
 238:                     : AllowColSwapping.Default;
 239:         }
 240:  
 241:  
 242:         // Enable/Desable Row expansion indicator.
 243:         private void UltraCheckEditorExpansionIndicatorCheckedChanged(object sender, EventArgs e)
 244:         {
 245:             ultraGrid1.DisplayLayout.Override.ExpansionIndicator =
 246:                 ultraGrid1.DisplayLayout.Override.ExpansionIndicator != ShowExpansionIndicator.Always
 247:                     ? ShowExpansionIndicator.Always
 248:                     : ShowExpansionIndicator.Never;
 249:         }
 250:  
 251:  
 252:         // Enable/Desable Row selector edit template
 253:         private void UltraCheckEditorRowSelectorEditTemplateCheckedChanged(object sender, EventArgs e)
 254:         {
 255:             ultraGrid1.DisplayLayout.Override.RowEditTemplateUIType =
 256:                 ultraGrid1.DisplayLayout.Override.RowEditTemplateUIType != RowEditTemplateUIType.RowSelectorImage
 257:                     ? RowEditTemplateUIType.RowSelectorImage
 258:                     : RowEditTemplateUIType.Default;
 259:         }
 260:  
 261:  
 262:         // Switch to CardView
 263:         private void UltraCheckEditorSwitchToCardViewCheckedChanged(object sender, EventArgs e)
 264:         {
 265:             ultraGrid1.DisplayLayout.Bands[0].CardView = !ultraGrid1.DisplayLayout.Bands[0].CardView;
 266:         }
 267:  
 268:  
 269:         // Select an item for FixedRowIndicator from the ComboBox.
 270:         // if the FixedRowIndicator = "Button" it will appear on the row selector.
 271:         private void UltraComboEditorFixedRowIndicatorValueChanged(object sender, EventArgs e)
 272:         {
 273:             var cb = ultraComboEditor_FixedRowIndicator;
 274:             if (cb == null || cb.SelectedItem == null) return;
 275:  
 276:             // Hint: Use DataValue instead of DataText if you are retrieving an item, because DataText gets localized.
 277:             ultraGrid1.DisplayLayout.Override.FixedRowIndicator = (FixedRowIndicator)cb.SelectedIndex;
 278:         }
 279:  
 280:  
 281:         // Select CardView style
 282:         private void UltraComboEditorSelectCardViewStyleValueChanged(object sender, EventArgs e)
 283:         {
 284:             var cb2 = ultraComboEditor_SelectCardViewStyle;
 285:             if (cb2 == null) return;
 286:  
 287:             ultraGrid1.DisplayLayout.Bands[0].CardSettings.Style = (CardStyle)cb2.SelectedIndex;
 288:         }
 289:  
 290:  
 291:         // Enamble/Desable Row summary button
 292:         private void UltraComboEditorEnableSummaryValueChanged(object sender, EventArgs e)
 293:         {
 294:             var cb3 = ultraComboEditor_EnableSummary;
 295:             if (cb3 == null) return;
 296:  
 297:             ultraGrid1.DisplayLayout.Override.AllowRowSummaries = (AllowRowSummaries)cb3.SelectedIndex;
 298:         }
 299:  
 300:         #region BtnEnableTouchClick
 301:         private void BtnEnableTouchClick(object sender, EventArgs e)
 302:         {
 303:             ultraTouchProvider1.Enabled = !ultraTouchProvider1.Enabled;
 304:             btnEnableTouch.Text = ultraTouchProvider1.Enabled ? Properties.Resources.Button_Disable_Touch : Properties.Resources.Button_Enable_Touch;
 305:  
 306:         } 
 307:         #endregion
 308:     } 
 309:         #endregion
 310: }

 

Touch WinListView And Tree

  

 1: using System;
 2: using System.Drawing;
 3: using System.IO;
 4: using System.Windows.Forms;
 5: using Infragistics.Win.UltraWinListView;
 6: using Infragistics.Win.UltraWinTree;
 7:  
 8: namespace TouchEnabledListViewAndTree.CS
 9: {
 10:     public partial class TouchForm : Form
 11:     {
 12:         #region Private Members
 13:         private readonly ImageList _imageList1;
 14:         private readonly string _imagePath = Application.ExecutablePath + "\\..\\..\\..\\..\\Images\\";
 15:         private const string ImageSuffix = ".png"; 
 16:         #endregion
 17:  
 18:         #region Constructor
 19:         public TouchForm()
 20:         {
 21:             InitializeComponent();
 22:             _imageList1 = new ImageList();
 23:         } 
 24:         #endregion
 25:  
 26:         #region Public Methods
 27:  
 28:         #region PopulateWinList
 29:         // Populate WinListView with local directory and files
 30:         public void PopulateWinList()
 31:         {
 32:             // Add some UltraListViewSubItemColumns to the control's SubItemColumns collection 
 33:             // to represent the file type, and date modified
 34:             UltraListViewSubItemColumn colFileType = ultraListView1.SubItemColumns.Add(Properties.Resources.UltraListView_FileType);
 35:             UltraListViewSubItemColumn colDateModified = ultraListView1.SubItemColumns.Add(Properties.Resources.UltraListView_DateModified);
 36:  
 37:  
 38:             // FileType...
 39:             // Set the DataType property to string
 40:             colFileType.DataType = typeof(string);
 41:  
 42:  
 43:             // Set the Text property to "Type"
 44:             colFileType.Text = Properties.Resources.UltraListView_Type;
 45:  
 46:  
 47:             // DateModified...
 48:             // Set the DataType property to DateTime
 49:             colDateModified.DataType = typeof(DateTime);
 50:  
 51:  
 52:             // Set the Text property to "Date Modified"
 53:             colDateModified.Text = Properties.Resources.UltraListView_DateModified;
 54:  
 55:  
 56:             // Set the Format property so that we display the short representation of 
 57:             // the date and time, appropriate for the current culture
 58:             var shortDateFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern;
 59:             var shortTimeFormat = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern;
 60:             colDateModified.Format = string.Format("{0} {1}", shortDateFormat, shortTimeFormat);
 61:  
 62:  
 63:             // MainColumn...
 64:             // Set the DataType to string
 65:             ultraListView1.MainColumn.DataType = typeof(string);
 66:  
 67:  
 68:             // Set the Text property to "Name"
 69:             ultraListView1.MainColumn.Text = Properties.Resources.UltraListView_Name;
 70:  
 71:  
 72:             // Add an appearance for the folder images, assigning to the folder items' Appearance
 73:             Infragistics.Win.Appearance appearance = ultraListView1.Appearances.Add(Properties.Resources.UltraListView_Folder);
 74:  
 75:             if (appearance != null)
 76:             {
 77:                 appearance.Image = new Bitmap(_imagePath + "Folder" + ImageSuffix);
 78:             }
 79:  
 80:             // Get a DirectoryInfo object that represents the C drive of the local machine
 81:             var cDriveInfo = new DirectoryInfo("C:\\");
 82:  
 83:  
 84:             // Get the directories and files
 85:             DirectoryInfo[] directories = cDriveInfo.GetDirectories();
 86:             FileInfo[] files = cDriveInfo.GetFiles();
 87:  
 88:  
 89:             // Iterate the directories and add an item for each one
 90:             for (int i = 0; i < directories.Length; i++)
 91:             {
 92:                 DirectoryInfo directoryInfo = directories[i];
 93:  
 94:                 UltraListViewItem item = ultraListView1.Items.Add(directoryInfo.FullName, directoryInfo.Name);
 95:                 item.SubItems["FileType"].Value = Properties.Resources.UltraListView_File_Folder;
 96:                 item.SubItems["DateModified"].Value = directoryInfo.LastWriteTime;
 97:                 item.Appearance = ultraListView1.Appearances[Properties.Resources.UltraListView_Folder];
 98:             }
 99:  
 100:             // Iterate the files and add an item for each one
 101:             for (int i = 0; i < files.Length; i++)
 102:             {
 103:                 FileInfo fileInfo = files[i];
 104:  
 105:                 UltraListViewItem item = ultraListView1.Items.Add(fileInfo.FullName, fileInfo.Name);
 106:                 item.SubItems["FileType"].Value = Properties.Resources.UltraListView_File;
 107:                 item.SubItems["DateModified"].Value = fileInfo.LastWriteTime;
 108:  
 109:                 // Check to see if the image collection contains an image for this extension, using the extension as a key.
 110:                 if (!_imageList1.Images.ContainsKey(fileInfo.Extension))
 111:                 {
 112:                     // Set an icon for the file.
 113:                     var iconForFile = Icon.ExtractAssociatedIcon(fileInfo.FullName);
 114:  
 115:                     if (iconForFile != null)
 116:                         _imageList1.Images.Add(fileInfo.Extension, iconForFile);
 117:                 }
 118:                 _imageList1.ImageSize = new Size(256, 256);
 119:                 item.Appearance.Image = _imageList1.Images[fileInfo.Extension];
 120:             }
 121:             ultraListView1.EndUpdate();
 122:         }
 123:         #endregion
 124:  
 125:         #endregion
 126:  
 127:         #region Events
 128:  
 129:         #region TouchFormLoad
 130:         private void TouchFormLoad(object sender, EventArgs e)
 131:         {
 132:             PopulateWinList();
 133:  
 134:             // Data Bind.
 135:             ultraTree1.DataSource = new Library().Categories;
 136:  
 137:             // Initialize the ComboEditors with default display values.
 138:             UltraComboEditor_UltraTreeViewStyle.SelectedIndex = 4;
 139:             UltraComboEditor_UltraTreeNodeStyle.SelectedIndex = 4;
 140:             UltraComboEditor_UltraListViewStyle.SelectedIndex = 1;
 141:         }
 142:         #endregion
 143:  
 144:         #region BtnEnableTouchClick
 145:         private void BtnEnableTouchClick(object sender, EventArgs e)
 146:         {
 147:             ultraTouchProvider1.Enabled = !ultraTouchProvider1.Enabled;
 148:             btnEnableTouch.Text = ultraTouchProvider1.Enabled ? Properties.Resources.Button_Disable_Touch : Properties.Resources.Button_Enable_Touch;
 149:         }
 150:         #endregion
 151:  
 152:         #region UltraComboEditorUltraListViewStyleValueChanged
 153:         // Set UltraListView style
 154:         private void UltraComboEditorUltraListViewStyleValueChanged(object sender, EventArgs e)
 155:         {
 156:             var cb = UltraComboEditor_UltraListViewStyle;
 157:             if (cb == null || cb.SelectedItem == null)
 158:                 return;
 159:             ultraListView1.View = (UltraListViewStyle)cb.SelectedIndex;
 160:         }
 161:         #endregion
 162:  
 163:         #region UltraCheckEditorCheckedChanged
 164:         // Enable Checkboxes for UltraListView (Only with Details or List view)
 165:         private void UltraCheckEditorCheckedChanged(object sender, EventArgs e)
 166:         {
 167:             if (UltraCheckEditor_EnableCheckboxes.Checked)
 168:             {
 169:                 ultraListView1.ViewSettingsDetails.CheckBoxStyle = CheckBoxStyle.CheckBox;
 170:                 ultraListView1.ViewSettingsList.CheckBoxStyle = CheckBoxStyle.CheckBox;
 171:             }
 172:             else
 173:             {
 174:                 ultraListView1.ViewSettingsDetails.CheckBoxStyle = CheckBoxStyle.None;
 175:                 ultraListView1.ViewSettingsList.CheckBoxStyle = CheckBoxStyle.None;
 176:             }
 177:         }
 178:         #endregion
 179:  
 180:         #region UltraComboEditorUltraTreeNodeStyleValueChanged
 181:         // Set UltraTree Node style (Only with Standard View)
 182:         private void UltraComboEditorUltraTreeNodeStyleValueChanged(object sender, EventArgs e)
 183:         {
 184:             var cb = UltraComboEditor_UltraTreeNodeStyle;
 185:             if (cb == null || cb.SelectedItem == null)
 186:                 return;
 187:             ultraTree1.Override.NodeStyle = (NodeStyle)cb.SelectedIndex;
 188:         }
 189:         #endregion
 190:  
 191:         #region UltraComboEditorUltraTreeViewStyleValueChanged
 192:         // Set UltraTree View style
 193:         private void UltraComboEditorUltraTreeViewStyleValueChanged(object sender, EventArgs e)
 194:         {
 195:             var cb = UltraComboEditor_UltraTreeViewStyle;
 196:             if (cb == null || cb.SelectedItem == null)
 197:                 return;
 198:             ultraTree1.ViewStyle = (ViewStyle)cb.SelectedIndex;
 199:         }
 200:         #endregion
 201:  
 202:         #endregion
 203:     }
 204: }

 

To play around with the Infragistics Windows Forms touch enabled applications on your own, be sure to get Infragistics Ultimate and see the chart in action in our latest sample application by clicking the banner below!