﻿<?xml version="1.0" encoding="utf-8"?><Type Name="DataGridViewCellContextMenuStripNeededEventArgs" FullName="System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs"><TypeSignature Language="C#" Value="public class DataGridViewCellContextMenuStripNeededEventArgs : System.Windows.Forms.DataGridViewCellEventArgs" /><AssemblyInfo><AssemblyName>System.Windows.Forms</AssemblyName><AssemblyVersion>2.0.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>System.Windows.Forms.DataGridViewCellEventArgs</BaseTypeName></Base><Interfaces /><Docs><since version=".NET 2.0" /><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>The <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event occurs only when the <see cref="T:System.Windows.Forms.DataGridView" /> control <see cref="P:System.Windows.Forms.DataGridView.DataSource" /> property is set or its <see cref="P:System.Windows.Forms.DataGridView.VirtualMode" /> property is true.</para><para>When you handle the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event, the shortcut menu that you specify in the handler is shown whenever the user right-clicks a cell. This is useful when you want to display shortcut menus determined by the current state or value of a cell. </para><para>The <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event also occurs whenever the value of the <see cref="P:System.Windows.Forms.DataGridViewCell.ContextMenuStrip" /> property is retrieved, either programmatically or when the user right-clicks the cell. </para><para>You can use the <see cref="P:System.Windows.Forms.DataGridViewCellEventArgs.ColumnIndex" /> and <see cref="P:System.Windows.Forms.DataGridViewCellEventArgs.RowIndex" /> properties to determine the state or value of a cell, and use this information to set the <see cref="P:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs.ContextMenuStrip" /> property. This property is initialized with the value of the cell <see cref="P:System.Windows.Forms.DataGridViewCell.ContextMenuStrip" /> property, which the event value overrides. </para><para>Handle the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event when working with large amounts of data to avoid the performance penalties of setting the cell <see cref="P:System.Windows.Forms.DataGridViewCell.ContextMenuStrip" /> value for multiple cells. For more information, see <format type="text/html"><a href="8321a8a6-6340-4fd1-b475-fa090b905aaf">Best Practices for Scaling the Windows Forms DataGridView Control</a></format>.</para><para>You can also specify shortcut menus for individual rows rather than individual cells by setting the row <see cref="P:System.Windows.Forms.DataGridViewRow.ContextMenuStrip" /> property or handling the <see cref="T:System.Windows.Forms.DataGridView" /> control's <see cref="E:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded" /> event. The cell <see cref="P:System.Windows.Forms.DataGridViewCell.ContextMenuStrip" /> property setting overrides the row <see cref="P:System.Windows.Forms.DataGridViewRow.ContextMenuStrip" /> property setting, and the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event overrides both the <see cref="E:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded" /> event and the row <see cref="P:System.Windows.Forms.DataGridViewRow.ContextMenuStrip" /> property setting. You can specify null for a cell shortcut menu, however, to prevent a row shortcut menu from being overridden.</para><para> For more information about handling events, see <format type="text/html"><a href="01e4f1bc-e55e-413f-98c7-6588493e5f67">Consuming Events</a></format>.</para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Provides data for the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event. </para></summary></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public DataGridViewCellContextMenuStripNeededEventArgs (int columnIndex, int rowIndex);" /><MemberType>Constructor</MemberType><Parameters><Parameter Name="columnIndex" Type="System.Int32" /><Parameter Name="rowIndex" Type="System.Int32" /></Parameters><Docs><remarks>To be added.</remarks><since version=".NET 2.0" /><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Initializes a new instance of the <see cref="T:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs" /> class. </para></summary><param name="columnIndex"><attribution license="cc4" from="Microsoft" modified="false" />The column index of cell that the event occurred for.</param><param name="rowIndex"><attribution license="cc4" from="Microsoft" modified="false" />The row index of the cell that the event occurred for.</param></Docs><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion></AssemblyInfo></Member><Member MemberName="ContextMenuStrip"><MemberSignature Language="C#" Value="public System.Windows.Forms.ContextMenuStrip ContextMenuStrip { set; get; }" /><MemberType>Property</MemberType><AssemblyInfo><AssemblyVersion>2.0.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>System.Windows.Forms.ContextMenuStrip</ReturnType></ReturnValue><Docs><value>To be added.</value><remarks><attribution license="cc4" from="Microsoft" modified="false" /><para>This property initially contains the value of the <see cref="P:System.Windows.Forms.DataGridViewCell.ContextMenuStrip" /> property if it has been set for a cell. </para></remarks><summary><attribution license="cc4" from="Microsoft" modified="false" /><para>Gets or sets the shortcut menu for the cell that raised the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event.</para></summary></Docs></Member></Members></Type>