|
31 | 31 | <Docs>
|
32 | 32 | <summary>Provides data for the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event.</summary>
|
33 | 33 | <remarks>
|
34 |
| - <format type="text/markdown"><. |
46 |
| - |
47 |
| - You can also specify shortcut menus for individual rows rather than individual cells by setting the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property or handling the <xref:System.Windows.Forms.DataGridView> control's <xref:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded> event. The cell <xref:System.Windows.Forms.DataGridViewCell.ContextMenuStrip%2A> property setting overrides the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property setting, and the <xref:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded> event overrides both the <xref:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded> event and the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property setting. You can specify `null` for a cell shortcut menu, however, to prevent a row shortcut menu from being overridden. |
48 |
| - |
49 |
| - For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/). |
50 |
| - |
51 |
| - |
52 |
| - |
53 |
| -## Examples |
54 |
| - The following code example uses the <xref:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs> class to set the shortcut menu without unsharing the row. |
55 |
| - |
| 34 | + <format type="text/markdown"><. |
| 46 | +
|
| 47 | + You can also specify shortcut menus for individual rows rather than individual cells by setting the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property or handling the <xref:System.Windows.Forms.DataGridView> control's <xref:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded> event. The cell <xref:System.Windows.Forms.DataGridViewCell.ContextMenuStrip%2A> property setting overrides the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property setting, and the <xref:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded> event overrides both the <xref:System.Windows.Forms.DataGridView.RowContextMenuStripNeeded> event and the row <xref:System.Windows.Forms.DataGridViewRow.ContextMenuStrip%2A> property setting. You can specify `null` for a cell shortcut menu, however, to prevent a row shortcut menu from being overridden. |
| 48 | +
|
| 49 | + For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/). |
| 50 | +
|
| 51 | +
|
| 52 | +
|
| 53 | +## Examples |
| 54 | + The following code example uses the <xref:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs> class to set the shortcut menu without unsharing the row. |
| 55 | +
|
56 | 56 | :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp" id="Snippet20":::
|
57 | 57 | :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContextMenuStripNeeded/sharedrows.cs" id="Snippet20":::
|
58 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/VB/sharedrows.vb" id="Snippet20"::: |
59 |
| - |
| 58 | + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/VB/sharedrows.vb" id="Snippet20"::: |
| 59 | +
|
60 | 60 | ]]></format>
|
61 | 61 | </remarks>
|
62 | 62 | <altmember cref="T:System.Windows.Forms.DataGridView" />
|
|
145 | 145 | <summary>Gets or sets the shortcut menu for the cell that raised the <see cref="E:System.Windows.Forms.DataGridView.CellContextMenuStripNeeded" /> event.</summary>
|
146 | 146 | <value>The <see cref="T:System.Windows.Forms.ContextMenuStrip" /> for the cell.</value>
|
147 | 147 | <remarks>
|
148 |
| - <format type="text/markdown"><![CDATA[ |
149 |
| - |
150 |
| -## Remarks |
151 |
| - This property initially contains the value of the <xref:System.Windows.Forms.DataGridViewCell.ContextMenuStrip%2A?displayProperty=nameWithType> property if it has been set for a cell. |
152 |
| - |
153 |
| - |
154 |
| - |
155 |
| -## Examples |
156 |
| - The following code example demonstrates an event handler that uses the <xref:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs.ContextMenuStrip%2A> property to set the shortcut menu for a cell. |
157 |
| - |
| 148 | + <format type="text/markdown"><![CDATA[ |
| 149 | +
|
| 150 | +## Remarks |
| 151 | + This property initially contains the value of the <xref:System.Windows.Forms.DataGridViewCell.ContextMenuStrip%2A?displayProperty=nameWithType> property if it has been set for a cell. |
| 152 | +
|
| 153 | +
|
| 154 | +
|
| 155 | +## Examples |
| 156 | + The following code example demonstrates an event handler that uses the <xref:System.Windows.Forms.DataGridViewCellContextMenuStripNeededEventArgs.ContextMenuStrip%2A> property to set the shortcut menu for a cell. |
| 157 | +
|
158 | 158 | :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp" id="Snippet22":::
|
159 | 159 | :::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContextMenuStripNeeded/sharedrows.cs" id="Snippet22":::
|
160 |
| - :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/VB/sharedrows.vb" id="Snippet22"::: |
161 |
| - |
| 160 | + :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/VB/sharedrows.vb" id="Snippet22"::: |
| 161 | +
|
162 | 162 | ]]></format>
|
163 | 163 | </remarks>
|
164 | 164 | <altmember cref="T:System.Windows.Forms.DataGridView" />
|
|
0 commit comments