/
DataGridViewButtonColumn.xml
540 lines (490 loc) · 40.6 KB
/
DataGridViewButtonColumn.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
<Type Name="DataGridViewButtonColumn" FullName="System.Windows.Forms.DataGridViewButtonColumn">
<TypeSignature Language="C#" Value="public class DataGridViewButtonColumn : System.Windows.Forms.DataGridViewColumn" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit DataGridViewButtonColumn extends System.Windows.Forms.DataGridViewColumn" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.DataGridViewButtonColumn" />
<TypeSignature Language="VB.NET" Value="Public Class DataGridViewButtonColumn
Inherits DataGridViewColumn" />
<TypeSignature Language="F#" Value="type DataGridViewButtonColumn = class
 inherit DataGridViewColumn" />
<TypeSignature Language="C++ CLI" Value="public ref class DataGridViewButtonColumn : System::Windows::Forms::DataGridViewColumn" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Windows.Forms.DataGridViewColumn</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewButtonColumn), "DataGridViewButtonColumn.bmp")]</AttributeName>
<AttributeName Language="F#">[<System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewButtonColumn), "DataGridViewButtonColumn.bmp")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewButtonColumn), "DataGridViewButtonColumn")]</AttributeName>
<AttributeName Language="F#">[<System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.DataGridViewButtonColumn), "DataGridViewButtonColumn")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(2)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(2)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Hosts a collection of <see cref="T:System.Windows.Forms.DataGridViewButtonCell" /> objects.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.DataGridViewButtonColumn> class is a specialized type of the <xref:System.Windows.Forms.DataGridViewColumn> class used to logically host cells that respond to simple user input. A <xref:System.Windows.Forms.DataGridViewButtonColumn> has an associated <xref:System.Windows.Forms.DataGridViewButtonCell> in every <xref:System.Windows.Forms.DataGridViewRow> that intersects it. Each cell supplies a user interface (UI) that is similar to a <xref:System.Windows.Forms.Button> control.
To display the same button text for every cell, set the <xref:System.Windows.Forms.DataGridViewButtonColumn.UseColumnTextForButtonValue%2A> property to `true` and set the <xref:System.Windows.Forms.DataGridViewButtonColumn.Text%2A> property to the desired button text.
The default sort mode for this column type is <xref:System.Windows.Forms.DataGridViewColumnSortMode.NotSortable>.
To respond to user button clicks, handle the <xref:System.Windows.Forms.DataGridView.CellClick?displayProperty=nameWithType> or <xref:System.Windows.Forms.DataGridView.CellContentClick?displayProperty=nameWithType> event. In the event handler, you can use the <xref:System.Windows.Forms.DataGridViewCellEventArgs.ColumnIndex%2A?displayProperty=nameWithType> property to determine whether the click occurred in the button column. You can use the <xref:System.Windows.Forms.DataGridViewCellEventArgs.RowIndex%2A?displayProperty=nameWithType> property to determine whether the click occurred in a button cell and not on the column header.
> [!NOTE]
> When visual styles are enabled, the buttons in a button column are painted using a <xref:System.Windows.Forms.ButtonRenderer>, and cell styles specified through properties such as <xref:System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle%2A> have no effect.
## Examples
The following code example demonstrates how to use a <xref:System.Windows.Forms.DataGridViewButtonColumn> to perform actions on particular rows. In this example, a <xref:System.Windows.Forms.DataGridView.CellClick?displayProperty=nameWithType> event handler first determines whether a click is on a button cell, then retrieves a business object associated with the row. This example is part of a larger example available in [How to: Access Objects in a Windows Forms DataGridViewComboBoxCell Drop-Down List](/dotnet/framework/winforms/controls/access-objects-in-a-wf-datagridviewcomboboxcell-drop-down-list).
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/AutoGenerateColumns/form1.cs" id="Snippet100":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewComboBoxObjectBinding/vb/form1.vb" id="Snippet100":::
]]></format>
</remarks>
<block subset="none" type="overrides">
<para>When you derive from <see cref="T:System.Windows.Forms.DataGridViewButtonColumn" /> and add new properties to the derived class, be sure to override the <see cref="M:System.Windows.Forms.DataGridViewButtonColumn.Clone" /> method to copy the new properties during cloning operations. You should also call the base class's <see cref="M:System.Windows.Forms.DataGridViewButtonColumn.Clone" /> method so that the properties of the base class are copied to the new cell.</para>
</block>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="T:System.Windows.Forms.DataGridViewColumn" />
<altmember cref="T:System.Windows.Forms.DataGridViewRow" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="T:System.Windows.Forms.Button" />
<altmember cref="P:System.Windows.Forms.DataGridViewColumn.SortMode" />
<altmember cref="E:System.Windows.Forms.DataGridView.CellClick" />
<related type="Article" href="/dotnet/framework/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid">How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control</related>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public DataGridViewButtonColumn ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.DataGridViewButtonColumn.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 DataGridViewButtonColumn();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Windows.Forms.DataGridViewButtonColumn" /> class to the default state.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor initializes the column by setting the following properties.
|Property|Value|
|--------------|-----------|
|<xref:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate%2A>|A new <xref:System.Windows.Forms.DataGridViewButtonCell>.|
|The <xref:System.Windows.Forms.DataGridViewCellStyle.Alignment%2A> property of the <xref:System.Windows.Forms.DataGridViewCellStyle> object returned by the <xref:System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle%2A> property.|<xref:System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter?displayProperty=nameWithType>|
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle" />
<altmember cref="T:System.Windows.Forms.DataGridViewCellStyle" />
<altmember cref="P:System.Windows.Forms.DataGridViewCellStyle.Alignment" />
</Docs>
</Member>
<Member MemberName="CellTemplate">
<MemberSignature Language="C#" Value="public override System.Windows.Forms.DataGridViewCell CellTemplate { get; set; }" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.DataGridViewCell CellTemplate" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property CellTemplate As DataGridViewCell" />
<MemberSignature Language="F#" Value="member this.CellTemplate : System.Windows.Forms.DataGridViewCell with get, set" Usage="System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property System::Windows::Forms::DataGridViewCell ^ CellTemplate { System::Windows::Forms::DataGridViewCell ^ get(); void set(System::Windows::Forms::DataGridViewCell ^ value); };" />
<MemberSignature Language="C#" Value="public override System.Windows.Forms.DataGridViewCell? CellTemplate { get; set; }" FrameworkAlternate="windowsdesktop-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.DataGridViewCell</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the template used to create new cells.</summary>
<value>A <see cref="T:System.Windows.Forms.DataGridViewCell" /> that all other cells in the column are modeled after.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The constructor for the <xref:System.Windows.Forms.DataGridViewButtonColumn> class initializes this property to a newly created <xref:System.Windows.Forms.DataGridViewButtonCell>.
> [!CAUTION]
> Changing the properties of the cell template will not immediately affect the user interface (UI) of the column's existing cells. These changes are only apparent after the column is regenerated (for example, by sorting the column or through a call to the <xref:System.Windows.Forms.DataGridView.InvalidateColumn%2A?displayProperty=nameWithType> method).
## Examples
The following code example demonstrates how to use a <xref:System.Windows.Forms.DataGridViewButtonColumn> to view the sales an employee has made. A cell template is used to apply the same color to all buttons. This example is part of a larger example available in the <xref:System.Windows.Forms.DataGridViewComboBoxColumn> class overview topic.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet10":::
]]></format>
</remarks>
<exception cref="T:System.InvalidCastException">The specified value when setting this property could not be cast to a <see cref="T:System.Windows.Forms.DataGridViewButtonCell" />.</exception>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="M:System.Windows.Forms.DataGridViewButtonColumn.#ctor" />
<altmember cref="T:System.Windows.Forms.DataGridViewCell" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="M:System.Windows.Forms.DataGridView.InvalidateColumn(System.Int32)" />
</Docs>
</Member>
<Member MemberName="Clone">
<MemberSignature Language="C#" Value="public override object Clone ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance object Clone() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.DataGridViewButtonColumn.Clone" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function Clone () As Object" />
<MemberSignature Language="F#" Value="override this.Clone : unit -> obj" Usage="dataGridViewButtonColumn.Clone " />
<MemberSignature Language="C++ CLI" Value="public:
 override System::Object ^ Clone();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Creates an exact copy of this column.</summary>
<returns>An <see cref="T:System.Object" /> that represents the cloned <see cref="T:System.Windows.Forms.DataGridViewButtonColumn" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to duplicate a column of button cells.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The value of the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" /> property is <see langword="null" />.</exception>
<block subset="none" type="overrides">
<para>When overriding <see cref="M:System.Windows.Forms.DataGridViewButtonColumn.Clone" /> in a derived class, call the base class's <see cref="M:System.Windows.Forms.DataGridViewButtonColumn.Clone" /> method so that the properties of the base class are copied to the new cell, and be sure to also copy the values of any properties that were added to the derived class.</para>
</block>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
</Docs>
</Member>
<Member MemberName="DefaultCellStyle">
<MemberSignature Language="C#" Value="public override System.Windows.Forms.DataGridViewCellStyle DefaultCellStyle { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Windows.Forms.DataGridViewCellStyle DefaultCellStyle" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle" />
<MemberSignature Language="VB.NET" Value="Public Overrides Property DefaultCellStyle As DataGridViewCellStyle" />
<MemberSignature Language="F#" Value="member this.DefaultCellStyle : System.Windows.Forms.DataGridViewCellStyle with get, set" Usage="System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property System::Windows::Forms::DataGridViewCellStyle ^ DefaultCellStyle { System::Windows::Forms::DataGridViewCellStyle ^ get(); void set(System::Windows::Forms::DataGridViewCellStyle ^ value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(true)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(true)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[get: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[set: System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<set: System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.DataGridViewCellStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the column's default cell style.</summary>
<value>The <see cref="T:System.Windows.Forms.DataGridViewCellStyle" /> to be applied as the default style.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default <xref:System.Windows.Forms.DataGridViewCellStyle> returned by this property has an initial <xref:System.Windows.Forms.DataGridViewCellStyle.Alignment%2A> property value of <xref:System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter>. This value overrides the value specified in the <xref:System.Windows.Forms.DataGridView.DefaultCellStyle%2A> property of the <xref:System.Windows.Forms.DataGridView> control, but may be overridden by other cell style properties. For more information, see [Cell Styles in the Windows Forms DataGridView Control](/dotnet/framework/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control).
> [!NOTE]
> When visual styles are enabled, the buttons in a button column are painted using a <xref:System.Windows.Forms.ButtonRenderer> and cell styles specified through properties such as <xref:System.Windows.Forms.DataGridViewButtonColumn.DefaultCellStyle%2A> have no effect.
## Examples
The following code example demonstrates the use of this property.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridViewButtonColumn/DefaultCellStyle/changecolumnalignment.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.GridViewContentAlignment/VB/changecolumnalignment.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="P:System.Windows.Forms.DataGridView.DefaultCellStyle" />
<altmember cref="T:System.Windows.Forms.DataGridViewCellStyle" />
<related type="Article" href="/dotnet/framework/winforms/controls/cell-styles-in-the-windows-forms-datagridview-control">Cell Styles in the Windows Forms DataGridView Control</related>
</Docs>
</Member>
<Member MemberName="FlatStyle">
<MemberSignature Language="C#" Value="public System.Windows.Forms.FlatStyle FlatStyle { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.Windows.Forms.FlatStyle FlatStyle" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.DataGridViewButtonColumn.FlatStyle" />
<MemberSignature Language="VB.NET" Value="Public Property FlatStyle As FlatStyle" />
<MemberSignature Language="F#" Value="member this.FlatStyle : System.Windows.Forms.FlatStyle with get, set" Usage="System.Windows.Forms.DataGridViewButtonColumn.FlatStyle" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::Windows::Forms::FlatStyle FlatStyle { System::Windows::Forms::FlatStyle get(); void set(System::Windows::Forms::FlatStyle value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(System.Windows.Forms.FlatStyle.Standard)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(System.Windows.Forms.FlatStyle.Standard)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[get: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<get: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[set: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<set: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Windows.Forms.FlatStyle</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the flat-style appearance of the button cells in the column.</summary>
<value>A <see cref="T:System.Windows.Forms.FlatStyle" /> value indicating the appearance of the buttons in the column. The default is <see cref="F:System.Windows.Forms.FlatStyle.Standard" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.DataGridViewButtonColumn.FlatStyle%2A> property specifies the appearance of the cells in the column. For more information, see the <xref:System.Windows.Forms.FlatStyle> enumeration.
Getting or setting this property gets or sets the <xref:System.Windows.Forms.DataGridViewButtonCell.FlatStyle%2A> property of the object returned by the <xref:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate%2A> property. Setting this property also sets the <xref:System.Windows.Forms.DataGridViewButtonCell.FlatStyle%2A> property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.
## Examples
The following code example demonstrates how to use a <xref:System.Windows.Forms.DataGridViewButtonColumn> to view the sales an employee has made. This example is part of a larger example available in the <xref:System.Windows.Forms.DataGridViewComboBoxColumn> class overview topic.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet10":::
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The value of the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" /> property is <see langword="null" />.</exception>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="T:System.Windows.Forms.FlatStyle" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonCell.FlatStyle" />
</Docs>
</Member>
<Member MemberName="Text">
<MemberSignature Language="C#" Value="public string Text { get; set; }" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0" />
<MemberSignature Language="ILAsm" Value=".property instance string Text" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.DataGridViewButtonColumn.Text" />
<MemberSignature Language="VB.NET" Value="Public Property Text As String" />
<MemberSignature Language="F#" Value="member this.Text : string with get, set" Usage="System.Windows.Forms.DataGridViewButtonColumn.Text" />
<MemberSignature Language="C++ CLI" Value="public:
 property System::String ^ Text { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="C#" Value="public string? Text { get; set; }" FrameworkAlternate="windowsdesktop-9.0" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(null)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(null)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the default text displayed on the button cell.</summary>
<value>A <see cref="T:System.String" /> that contains the text. The default is <see cref="F:System.String.Empty" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Each <xref:System.Windows.Forms.DataGridViewButtonCell> contained in the column that has as a <xref:System.Windows.Forms.DataGridViewButtonCell.UseColumnTextForButtonValue%2A> property value of `true` displays the <xref:System.Windows.Forms.DataGridViewButtonColumn.Text%2A> property value on the cell's button.
If there is an associated <xref:System.Windows.Forms.DataGridView> control, changing this property refreshes the column display.
## Examples
The following code example demonstrates how to use a <xref:System.Windows.Forms.DataGridViewButtonColumn> to view the sales an employee has made. The <xref:System.Windows.Forms.DataGridViewButtonColumn.Text%2A> property is used to set the column header. This example is part of a larger example available in the <xref:System.Windows.Forms.DataGridViewComboBoxColumn> class overview topic.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp" id="Snippet10":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellContentClick/employees.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/VB/employees.vb" id="Snippet10":::
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">When setting this property, the value of the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" /> property is <see langword="null" />.</exception>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonCell.UseColumnTextForButtonValue" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.UseColumnTextForButtonValue" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
</Docs>
</Member>
<Member MemberName="ToString">
<MemberSignature Language="C#" Value="public override string ToString ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig virtual instance string ToString() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.DataGridViewButtonColumn.ToString" />
<MemberSignature Language="VB.NET" Value="Public Overrides Function ToString () As String" />
<MemberSignature Language="F#" Value="override this.ToString : unit -> string" Usage="dataGridViewButtonColumn.ToString " />
<MemberSignature Language="C++ CLI" Value="public:
 override System::String ^ ToString();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.NullableContext(1)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.NullableContext(1)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets a string that describes the column.</summary>
<returns>A <see cref="T:System.String" /> that describes the column.</returns>
<remarks>To be added.</remarks>
<altmember cref="M:System.Windows.Forms.DataGridViewColumn.ToString" />
</Docs>
</Member>
<Member MemberName="UseColumnTextForButtonValue">
<MemberSignature Language="C#" Value="public bool UseColumnTextForButtonValue { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool UseColumnTextForButtonValue" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.DataGridViewButtonColumn.UseColumnTextForButtonValue" />
<MemberSignature Language="VB.NET" Value="Public Property UseColumnTextForButtonValue As Boolean" />
<MemberSignature Language="F#" Value="member this.UseColumnTextForButtonValue : bool with get, set" Usage="System.Windows.Forms.DataGridViewButtonColumn.UseColumnTextForButtonValue" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool UseColumnTextForButtonValue { bool get(); void set(bool value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DefaultValue(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DefaultValue(false)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[get: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<get: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[set: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")]</AttributeName>
<AttributeName Language="F#">[<set: System.Diagnostics.CodeAnalysis.MemberNotNull("ButtonCellTemplate")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.Text" /> property value is displayed as the button text for cells in this column.</summary>
<value>
<see langword="true" /> if the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.Text" /> property value is displayed on buttons in the column; <see langword="false" /> if the <see cref="P:System.Windows.Forms.DataGridViewCell.FormattedValue" /> property value of each cell is displayed on its button. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
By default, the <xref:System.Windows.Forms.DataGridViewCell.FormattedValue%2A?displayProperty=nameWithType> of a button cell is displayed as the text on the button. The <xref:System.Windows.Forms.DataGridViewButtonColumn.UseColumnTextForButtonValue%2A> property allows you to either set the button text for each cell, or to use the <xref:System.Windows.Forms.DataGridViewButtonColumn.Text%2A> property value for all of the button cells.
Getting or setting this property gets or sets the <xref:System.Windows.Forms.DataGridViewButtonCell.UseColumnTextForButtonValue%2A> property of the object returned by the <xref:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate%2A> property. Setting this property also sets the <xref:System.Windows.Forms.DataGridViewButtonCell.UseColumnTextForButtonValue%2A> property of every cell in the column and refreshes the column display. To override the specified value for individual cells, set the cell values after you set the column value.
## Examples
The following code example demonstrates the use of this property.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/DataGridView/CellBeginEdit/datagridviewmisc.cs" id="Snippet010":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewMisc/VB/datagridviewmisc.vb" id="Snippet010":::
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The value of the <see cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" /> property is <see langword="null" />.</exception>
<altmember cref="T:System.Windows.Forms.DataGridView" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.Text" />
<altmember cref="P:System.Windows.Forms.DataGridViewCell.FormattedValue" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonColumn.CellTemplate" />
<altmember cref="T:System.Windows.Forms.DataGridViewButtonCell" />
<altmember cref="P:System.Windows.Forms.DataGridViewButtonCell.UseColumnTextForButtonValue" />
<related type="Article" href="/dotnet/framework/winforms/controls/disable-buttons-in-a-button-column-in-the-datagrid">How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control</related>
</Docs>
</Member>
</Members>
</Type>