//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { if (iid == InvokePattern.Pattern && WindowsListView.ListViewInvokable(_hwnd)) { return(this); } if (iid == SelectionItemPattern.Pattern) { return(this); } if (iid == ValuePattern.Pattern && WindowsListView.ListViewEditable(_hwnd)) { return(this); } if (iid == GridItemPattern.Pattern && IsImplementingGrid(_hwnd)) { return(this); } if (iid == TogglePattern.Pattern && IsItemWithCheckbox(_hwnd, _item)) { return(CreateListViewItemCheckbox()); } if (iid == ScrollItemPattern.Pattern && WindowScroll.IsScrollable(_hwnd)) { return(this); } return(null); }
void IScrollItemProvider.ScrollIntoView() { if (_listBox._parentedByCombo && !SafeNativeMethods.IsWindowVisible(_hwnd)) { throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed)); } if (!WindowScroll.IsScrollable(_hwnd)) { throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed)); } // It is assumed that in a listbox an item will always be smaller than the scrolling area Misc.ProxySendMessage(_hwnd, NativeMethods.LB_SETTOPINDEX, new IntPtr(_item), IntPtr.Zero); }
//------------------------------------------------------ // // Patterns Implementation // //------------------------------------------------------ #region ProxySimple Interface // Returns a pattern interface if supported. internal override object GetPatternProvider(AutomationPattern iid) { if (iid == SelectionItemPattern.Pattern) { return(this); } else if (iid == ScrollItemPattern.Pattern && WindowScroll.IsScrollable(_hwnd)) { return(this); } else if (_listBox.IsWinFormCheckedListBox() && iid == TogglePattern.Pattern) { return(this); } return(null); }