FlexGrid 1.0.6
dotnet add package FlexGrid --version 1.0.6
NuGet\Install-Package FlexGrid -Version 1.0.6
<PackageReference Include="FlexGrid" Version="1.0.6" />
paket add FlexGrid --version 1.0.6
#r "nuget: FlexGrid, 1.0.6"
// Install FlexGrid as a Cake Addin
#addin nuget:?package=FlexGrid&version=1.0.6
// Install FlexGrid as a Cake Tool
#tool nuget:?package=FlexGrid&version=1.0.6
FlexGrid
FlexGrid is a custom WPF DataGrid with convenient and useful features. When developing code using WPF, the Microsoft-supported DataGrid has limited functionality, such as nested and merged column headers and variable columns. However, with FlexGrid, your DataGrid development environment becomes significantly more convenient!
<br>
I'm proud to say that FlexGrid was fully built by me, and I'm excited to share it on GitHub 😃
<br>
Goal
- Create Customized DataGrid with convenient and useful features.
- Use FlexGrid to develop other WPF Programs
<br>
Available Features
- FlexGrid Template Structure
- Using Bands Instead Of Columns
- Bands and Frozen Bands
- Mergable Column Header (Band.Bands)
- Variable Columns (VirtualBand)
<br>
FlexGrid Template Structure
FlexGrid is a Component that modified the Template of the default DataGrid.
<p align="center"> <img src="./resources/images/FlexGridTemplateStructure.png" alt="FlexGridTemplateStructure.png" /> <br> <FlexGrid Template Structure> </p>
Using Bands Instead Of Columns
FlexGrid uses BandHeadersPresenters to represent the columns. The BandHeaderPresenter represents the Bands in FlexGrid.FrozenBands and FlexGrid.Bands as Columns in the FlexGrid.
Band Types
- TextBand
- CheckBoxBand
- ComboBoxBand
- TemplateBand
- VirtualBand
- VirtualTextBand
- VirtualCheckBoxBand
- VirtualComboBoxBand
- VirtualTemplateBand
This is Example how to use Bands.
<c:FlexGrid>
<c:FlexGrid.Bands>
<c:TextBand
Width="100"
HorizontalAlignment="Center"
Header="Name"
TextBinding="{Binding Name}" />
<c:TemplateBand Width="250" Header="WebSite">
<c:TemplateBand.CellTemplate>
<DataTemplate>
<TextBlock>
<Hyperlink
NavigateUri="{Binding WebSite}"
RequestNavigate="OnHyperlinkRequestNavigate">
<TextBlock Text="{Binding WebSite}" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</c:TemplateBand.CellTemplate>
<c:TemplateBand.CellEditingTemplate>
<DataTemplate>
<TextBox Text="{Binding WebSite}" />
</DataTemplate>
</c:TemplateBand.CellEditingTemplate>
</c:TemplateBand>
</c:FlexGrid.Bands>
</c:FlexGrid>
<br>
Bands and Frozen Bands
For represent Frozen Columns (Always showed Columns) in FlexGrid. You should use FlexGrid.FrozenBands.
The FlexGrid shows to Bands in FlexGrid.FrozenBands as Frozen Columns.
This is Example Code how to use Frozen Bands.
<c:FlexGrid>
<c:FlexGrid.FrozenBands>
<c:TextBand
Width="100"
HorizontalAlignment="Center"
Header="Name"
TextBinding="{Binding Name}" />
<c:TextBand
Width="150"
HorizontalAlignment="Center"
Header="BirthDate"
TextBinding="{Binding BirthDate}" />
</c:FlexGrid.FrozenBands>
<c:FlexGrid.Bands>
<c:TextBand
Width="200"
Header="Address"
TextBinding="{Binding Address}" />
</c:FlexGrid.Bands>
</c:FlexGrid>
<br>
Mergable Column Header (Band.Bands)
The Bands
Property in Band can be used to represent Merged Column Headers.
<p align="center"> <img src="./resources/images/FlexGridMergedHeader.png" alt="FlexGridMergedHeader.png" /> <br> <Merged Column Headers> </p>
Related StackOverflow questions:
- Multilevel column header for datagrid in wpf<br>
- Wpf datagrid header above header<br>
- Merge header columns datagrid wpf <br><br>
This is Example Code how to use Band.Bands Object.
<c:FlexGrid>
<c:FlexGrid.Bands>
<c:TextBand Header="Information">
<c:TextBand.Bands>
<c:TextBand
Width="100"
HorizontalAlignment="Center"
Header="Name"
TextBinding="{Binding Name}" />
<c:TextBand
Width="150"
HorizontalAlignment="Center"
Header="BirthDate"
TextBinding="{Binding BirthDate}" />
<c:TextBand
Width="200"
Header="Address"
TextBinding="{Binding Address}" />
<c:TemplateBand Width="250" Header="WebSite">
<c:TemplateBand.CellTemplate>
<DataTemplate>
<TextBlock>
<Hyperlink NavigateUri="{Binding WebSite}" RequestNavigate="OnHyperlinkRequestNavigate">
<TextBlock Text="{Binding WebSite}" />
</Hyperlink>
</TextBlock>
</DataTemplate>
</c:TemplateBand.CellTemplate>
<c:TemplateBand.CellEditingTemplate>
<DataTemplate>
<TextBox Text="{Binding WebSite}" />
</DataTemplate>
</c:TemplateBand.CellEditingTemplate>
</c:TemplateBand>
</c:TextBand.Bands>
</c:TextBand>
</c:FlexGrid.Bands>
</c:FlexGrid>
<br>
Variable Columns (VirtualBand & VirtualBandBinding)
FlexGrid can represent varaible columns by VirtualBand
class.
<br>
List of All kind of VirtualBand
.
VirtualTextBand
VirtualCheckBoxBand
VirtualComboBoxBand
VirtualTemplateBand
<br>
Related StackOverflow questions:
- How do i bind a wpf datagrid to a variable number of columns<br>
- How do i dynamically generate columns in a wpf datagrid<br>
Related CodeProject Articles:
<br>
This is Example Code how to use VirtualBands.
<c:FlexGrid>
<c:FlexGrid.FrozenBands>
<c:TextBand
Width="100"
HorizontalAlignment="Center"
Header="Name"
TextBinding="{Binding Name}" />
<c:TextBand
Width="150"
HorizontalAlignment="Center"
Header="BirthDate"
TextBinding="{Binding BirthDate}" />
<c:TextBand
Width="150"
Header="Address"
TextBinding="{Binding Address}" />
</c:FlexGrid.FrozenBands>
<c:FlexGrid.Bands>
<c:TextBand Header="Subject Scores">
<c:TextBand.Bands>
<c:VirtualTemplateBand
x:Name="vbandSubjects"
Width="100"
HeaderBinding="{Binding Name}">
<c:VirtualTemplateBand.CellTemplate>
<DataTemplate>
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<TextBlock Text="{c:VirtualBandBinding Grade}" />
<TextBlock Text="(" />
<TextBlock Text="{c:VirtualBandBinding Value}" />
<TextBlock Text=")" />
</StackPanel>
</DataTemplate>
</c:VirtualTemplateBand.CellTemplate>
<c:VirtualTemplateBand.CellEditingTemplate>
<DataTemplate>
<TextBox
VerticalContentAlignment="Center"
Text="{c:VirtualBandBinding Value}"
TextAlignment="Center" />
</DataTemplate>
</c:VirtualTemplateBand.CellEditingTemplate>
</c:VirtualTemplateBand>
</c:TextBand.Bands>
</c:TextBand>
</c:FlexGrid.Bands>
</c:FlexGrid>
<br>
The VirtualBandBinding
is the class to binding property to generated bands by VirtualBand
. FlexGrid converts the Items in the VirtualBand to Columns, while mapping the VirtualBandBinding to each property appropriately so that the data appears in the Cell.
Refer to the code below.
https://github.com/soomin-kevin-sung/dotnet-flexgrid/blob/c4e05c1f2c0517c263fdca6026c2e74f2cda1fe9/src/KevinComponent/Band.cs#L469-L496
<br>
Samples
Basic Sample
<p align="center"> <img src="./resources/images/BasicSample.gif" alt="BasicSample.gif" /> <br> <BasicSample ScreenShot> </p>
BasicSample
shows the basic usage of FlexGrid.<br>- You can know how to use
FlexGrid
the basically in this sample.
<br>
Frozen Header Sample
<p align="center"> <img src="./resources/images/FrozenHeaderSample.gif" alt="BasicSample.gif" /> <br> <FrozenHedaerSample ScreenShot> </p>
- FrozenHedaerSample shows how to using the frozen columns.<br>
- You can use
FlexGrid.FrozenBands
to add frozen columns. - In this sample, the Name, BirthDate bands are Frozen Bands.
<br>
Merged Header Sample
<p align="center"> <img src="./resources/images/MergedHeaderSample.gif" alt="BasicSample.gif" /> <br> <MergedHedaerSample ScreenShot> </p>
- MergedHedaerSample shows how to merge column headers.<br>
- You can use
Band.Bands
(ex. TextBand.Bands, CheckBoxBand.Bands, etc.) to merge column headers. - In this sample, you can see the Name, BirthDate, Address, and WebSite bands merged into the information band.
<br>
VirtualBand Sample
<p align="center"> <img src="./resources/images/VirtualBandSample.gif" alt="VirtualBandSample.gif" width=960px/> <br> <VirtualBandSample ScreenShot> </p>
- VirtualBandSample shows how variable columns are implemented in FlexGrid.<br>
- You can use
VirtualBand
(ex. VirtualTextBand, VirtualComboBoxBand, VirtualCheckBoxBand, etc.) to show variable columns. - In this Sample, you can see that the list of subject scores synchronizes with the subject list when you edit the subject list.
<p align="center"> <img src="./resources/images/VirtualBandSample_ItemsSource_Image.png" alt="VirtualBandSample.gif" width=960px/> <br> <ItemsSource Description> </p>
<br>
Colored BandHeader Sample
<p align="center"> <img src="./resources/images/ColoredBandHeaderSample.png" alt="ColoredBandHeaderSample.png" /> <br> <ColoredBandHeaderSample ScreenShot> </p>
- ColoredBandHeaderSample shows how to set header and cell style.
- You can use
Band.HeaderStyle
andBand.CellStyle
to set header style and cell style.
<br>
Support
If you have any good ideas (such as new featrue, refactoring, improvement feature quality, etc), do not hesitate to let me know!<br> You also can "Pull request" or request adding New Feature to the email below. Thank you.
- E-mail : ssm0725@gmail.com
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net6.0-windows7.0 is compatible. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.1 is compatible. |
.NET Framework | net48 is compatible. net481 was computed. |
-
.NETCoreApp 3.1
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
net6.0-windows7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
.net48 .netcoreapp3.1 supported.