Skip to content

Commit f967b0d

Browse files
committed
fixed datagrid author
1 parent be52f09 commit f967b0d

8 files changed

+53
-53
lines changed

docs/controls/datagrid_guidance/customize_autogenerated_columns.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Customize Auto-Generated Columns in the DataGrid Control
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to customize auto generated columns in the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml, AutoGenerateColumns
66
---
@@ -12,7 +12,7 @@ The [DataGrid](../datagrid.md) control supports the option to automatically gene
1212
```xml
1313
<controls:DataGrid AutoGenerateColumns="True"/>
1414
<!-- Autogenerates column headers and columns based on the Data model provided -->
15-
```
15+
```
1616

1717
You can modify the **DataGrid.Columns** collection at run time regardless of whether it contains generated columns. However, if you specify columns in XAML, you should set AutoGenerateColumns to false in order to avoid duplication.
1818

@@ -21,19 +21,19 @@ You can handle the DataGrid's **AutoGeneratingColumn** event to modify, replace,
2121
## To handle the AutoGeneratingColumn event
2222

2323
1. Create an event handler for the DataGrid's **AutoGeneratingColumn** event.
24-
```C#
25-
private void dataGrid1_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
26-
{
24+
```C#
25+
private void dataGrid1_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
26+
{
2727
//...
28-
}
29-
```
28+
}
29+
```
3030

3131
2. Add the event handler to the DataGrid instances events.
32-
```xml
33-
<controls:DataGrid x:Name="dataGrid1"
32+
```xml
33+
<controls:DataGrid x:Name="dataGrid1"
3434
AutoGenerateColumns="True"
3535
AutoGeneratingColumn="dataGrid1_AutoGeneratingColumn"/>
36-
```
36+
```
3737

3838
## To modify a generated column
3939

@@ -44,27 +44,27 @@ if (e.Column.Header.ToString() == "Name")
4444
{
4545
e.Column.Header = "Task";
4646
}
47-
```
47+
```
4848

4949
## To replace a generated column
5050

5151
1. In the AutoGeneratingColumn event handler, create a new **DataGridColumn**.
52-
```C#
53-
//Replace the DueDate column with a custom template column.
54-
if (e.PropertyName = "DueDate")
55-
{
52+
```C#
53+
//Replace the DueDate column with a custom template column.
54+
if (e.PropertyName = "DueDate")
55+
{
5656
//Create a new template column.
5757
var templateColumn = new DataGridTemplateColumn();
5858
templateColumn.Header = "Due Date";
5959
//...
60-
}
61-
```
60+
}
61+
```
6262

6363
2. Replace the column from the **DataGridAutoGeneratingColumnEventArgs.Column** property with the new **DataGridColumn** instance.
64-
```C#
65-
//Replace the auto-generated column with the templateColumn.
66-
e.Column = templateColumn;
67-
```
64+
```C#
65+
//Replace the auto-generated column with the templateColumn.
66+
e.Column = templateColumn;
67+
```
6868

6969
## To cancel generation of a column
7070

@@ -75,7 +75,7 @@ if (e.PropertyType == GetType(Boolean))
7575
{
7676
e.Cancel = True;
7777
}
78-
```
78+
```
7979

8080
## See Also
8181

docs/controls/datagrid_guidance/datagrid_basics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Add a DataGrid control to a page
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to add a DataGrid control and display data in rows and columns
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml
66
---

docs/controls/datagrid_guidance/editing_inputvalidation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Implement editing functionality
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to implement editing and input validation functionality in the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml
66
---
@@ -12,7 +12,7 @@ The [DataGrid](../datagrid.md) control supports cell and row editing functionali
1212

1313
```xml
1414
<controls:DataGrid BeginningEdit="dg_Editing" CellEditEnding="dg_CellEditEnding" RowEditEnding="dg_RowEditEnding" />
15-
```
15+
```
1616

1717
![Editing](../../resources/images/Controls/DataGrid/editing.png)
1818

docs/controls/datagrid_guidance/group_sort_filter.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Group, Sort and Filter data in the DataGrid Control
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to group, sort and filter data in the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml, group, sort, filter
66
---
@@ -28,7 +28,7 @@ The following walk-through shows how to implement and customize grouping in the
2828
AutoGenerateColumns="True">
2929

3030
</controls:DataGrid>
31-
```
31+
```
3232

3333
2. Create the grouped collection using LINQ
3434

@@ -52,7 +52,7 @@ foreach (var g in query)
5252
}
5353
mountains.Add(info);
5454
}
55-
```
55+
```
5656

5757
3. Populate a CollectionViewSource instance with the grouped collection and set IsSourceGrouped property to True.
5858

@@ -61,14 +61,14 @@ foreach (var g in query)
6161
CollectionViewSource groupedItems = new CollectionViewSource();
6262
groupedItems.IsSourceGrouped = true;
6363
groupedItems.Source = mountains;
64-
```
64+
```
6565

6666
4. Set the ItemsSource of the DataGrid control
6767

6868
```C#
6969
//Set the datagrid's ItemsSource to grouped collection view source
7070
dg.ItemsSource = groupedItems.View;
71-
```
71+
```
7272

7373
5. Customize the Group header values through **RowGroupHeaderStyles**, **RowGroupHeaderPropertyNameAlternative** properties and by handling the **LoadingRowGroup** event to alter the auto-generated values in code.
7474

@@ -86,7 +86,7 @@ dg.ItemsSource = groupedItems.View;
8686
</Style>
8787
</controls:DataGrid.RowGroupHeaderStyles>
8888
</controls:DataGrid>
89-
```
89+
```
9090

9191
```C#
9292
//Handle the LoadingRowGroup event to alter the grouped header property value to be displayed
@@ -96,7 +96,7 @@ private void dg_loadingRowGroup(object sender, DataGridRowGroupHeaderEventArgs e
9696
Mountain item = group.GroupItems[0] as Mountain;
9797
e.RowGroupHeader.PropertyValue = item.Range;
9898
}
99-
```
99+
```
100100

101101
![Group](../../resources/images/Controls/DataGrid/grouping.png)
102102

@@ -126,7 +126,7 @@ The following walk-through shows how to implement sorting in the DataGrid contro
126126
<!-- Add more columns -->
127127
</controls:DataGrid.Columns>
128128
</controls:DataGrid>
129-
```
129+
```
130130

131131
2. Handle the Sorting event to implement logic for sorting
132132

@@ -144,7 +144,7 @@ private void dg_Sorting(object sender, DataGridColumnEventArgs e)
144144
select item);
145145
}
146146
// ...
147-
```
147+
```
148148

149149
3. Set the SortDirection property to the approrpriate value for showing the built-in ascending sort icon in column header
150150

@@ -158,7 +158,7 @@ e.Column.SortDirection = DataGridSortDirection.Ascending;
158158
//Clear the SortDirection in a previously sorted column when a different column is sorted
159159
previousSortedColumn.SortDirection = null;
160160

161-
```
161+
```
162162
![Sort](../../resources/images/Controls/DataGrid/sorting.png)
163163

164164
## 3. Filtering
@@ -172,7 +172,7 @@ The DataGrid control does not support any built-in filtering capabilities. The f
172172
x:Name="dg"
173173
Height="600" Margin="12"
174174
AutoGenerateColumns="True"/>
175-
```
175+
```
176176

177177
2. Add buttons for filtering the DataGrid's content. It is recommended to use the **CommandBar** control with **AppBarButtons** to add filtering visuals at the top of your page. The following example shows a CommandBar with the title for the table and one filter button.
178178

@@ -185,7 +185,7 @@ The DataGrid control does not support any built-in filtering capabilities. The f
185185
Label="Filter by Rank &lt; 50"
186186
Click="rankLowFilter_Click">
187187
</CommandBar>
188-
```
188+
```
189189

190190
3. Handle the AppBarButton's Click event to implement the filtering logic.
191191

@@ -196,7 +196,7 @@ private void rankLowFilter_Click(object sender, RoutedEventArgs e)
196196
where item.Rank < 50
197197
select item);
198198
}
199-
```
199+
```
200200

201201
## Example app
202202

docs/controls/datagrid_guidance/keyboard_navigation_selection.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Keyboard navigation and selection concepts in the DataGrid control
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to use keyboard to navigate the DataGrid control and selection models
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml, keyboard
66
---
@@ -49,7 +49,7 @@ The DataGrid control supports single row selection as well as multiple rows sele
4949

5050
```xml
5151
<controls:DataGrid SelectionMode="Extended"/>
52-
```
52+
```
5353
![Selection](../../resources/images/Controls/DataGrid/selection.png)
5454

5555
If the **SelectionMode** property is set to **Extended**, the navigation behavior does not change, but navigating with the keyboard while pressing SHIFT (including CTRL+SHIFT) will modify a multi-row selection. Before navigation starts, the control marks the current row as an anchor row. When you navigate while pressing SHIFT, the selection includes all rows between the anchor row and the current row.

docs/controls/datagrid_guidance/rowdetails.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Display and Configure Row Details in the DataGrid Control
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to customize row details section in the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml, RowDetails
66
---
@@ -32,7 +32,7 @@ The row details section can be displayed for selected rows, displayed for all ro
3232
</DataTemplate>
3333
</controls:DataGrid.RowDetailsTemplate>
3434
</controls:DataGrid>
35-
```
35+
```
3636

3737
## To display a row details section using a DataTemplate resource
3838

@@ -52,7 +52,7 @@ The row details section can be displayed for selected rows, displayed for all ro
5252
RowDetailsTemplate="{StaticResource RowDetailsTemplate}" />
5353

5454
</Page>
55-
```
55+
```
5656

5757
## To change the visibility of a row details section
5858

@@ -79,14 +79,14 @@ private void cbRowDetailsVis_SelectionChanged(object sender, RoutedEventArgs e)
7979
dataGrid1.RowDetailsVisibilityMode = DataGridRowDetailsVisibilityMode.Visible;
8080
}
8181
}
82-
```
82+
```
8383
## To prevent a row details section from scrolling horizontally
8484

8585
Set the **AreRowDetailsFrozen** property to true.
8686
```xml
8787
<controls:DataGrid
8888
AreRowDetailsFrozen="True" />
89-
```
89+
```
9090

9191
## See Also
9292

docs/controls/datagrid_guidance/sizing_options.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Use the different sizing options in the DataGrid control
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to size the rows, columns and headers of the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml
66
---

docs/controls/datagrid_guidance/styling_formatting_options.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: How to - Customize the DataGrid control through UI formatting options
3-
author: harinik
3+
author: harinikmsft
44
description: Guidance document that shows how to use the different formatting options to customize the look and feel of the DataGrid control
55
keywords: windows 10, uwp, windows community toolkit, windows toolkit, DataGrid, xaml control, xaml
66
---
@@ -20,7 +20,7 @@ You can also change the color of the gridlines using **HorizontalGridLinesBrush*
2020

2121
```xml
2222
<controls:DataGrid GridLinesVisibility="All"/>
23-
```
23+
```
2424
![Gridlines](../../resources/images/Controls/DataGrid/gridlines.png)
2525

2626
## 2. Alternating rows
@@ -30,7 +30,7 @@ The RowBackground and RowForeground properties are used to paint the background
3030

3131
```xml
3232
<controls:DataGrid AlternatingRowBackground="LightGray"/>
33-
```
33+
```
3434
![AlternatingRowBackground](../../resources/images/Controls/DataGrid/alternaterowbackground.png)
3535

3636
## 3. Headers visibility
@@ -44,7 +44,7 @@ Note: By default, DataGrid row headers are not displayed. To display row headers
4444

4545
```xml
4646
<controls:DataGrid HeadersVisibility="Column"/>
47-
```
47+
```
4848
![Headers](../../resources/images/Controls/DataGrid/gridlines.png)
4949

5050
## 4. Customizable templates and styling for cells, rows and headers
@@ -64,14 +64,14 @@ You can also use properties such as **RowHeight**, **RowHeaderWidth**, **ColumnW
6464
<controls:DataGrid CellStyle="{StaticResource cellStyle}" />
6565

6666
<controls:DataGridTemplateColumn Header="Range" CellTemplate="{StaticResource cellTemplate}" />
67-
```
67+
```
6868

6969
## 5. Frozen columns
7070
Frozen columns are columns that are always displayed and cannot be scrolled out of visibility. Frozen columns are always the leftmost columns in display order. You cannot drag frozen columns into the group of unfrozen columns or drag unfrozen columns into the group of frozen columns. Set the **DataGrid.FrozenColumnCount** property to the desired number of columns that the user should not scroll horizontally.
7171

7272
```xml
7373
<controls:DataGrid FrozenColumnCount="2"/>
74-
```
74+
```
7575
![FrozenColumns](../../resources/images/Controls/DataGrid/frozencolumns.png)
7676

7777
## 6. Reorder and resize columns
@@ -82,7 +82,7 @@ You can allow users to:
8282

8383
```xml
8484
<controls:DataGrid CanUserReorderColumns="True" CanUserResizeColumns="True"/>
85-
```
85+
```
8686

8787
![ResizeColumns](../../resources/images/Controls/DataGrid/resizecolumns.png)
8888

0 commit comments

Comments
 (0)