This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace DataGridViewAutoFilterDemo | |
{ | |
public class Person | |
{ | |
private readonly Random random = new Random(); | |
public int Rank { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ShowAllLabel_Click(object sender, EventArgs e) | |
{ | |
DataGridViewAutoFilterTextBoxColumn.RemoveFilter(dataGridView1); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Enable filtering on grid columns by setting the value to true. | |
/// It's false by default. | |
/// </summary> | |
/// <param name="value"></param> | |
private void EnableGridFilter(bool value) | |
{ | |
RankColumn.FilteringEnabled = value; | |
OccupationColumn.FilteringEnabled = value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Object of Person model | |
private Person personObject = new Person(); | |
// List to hold person details | |
private List<Person> personList = new List<Person>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void TestAppForm_Load(object sender, EventArgs e) | |
{ | |
// Invoke the method PopulateList using the person object | |
// Pass the personList as the parameter. | |
personObject.PopulateList(personList); | |
// Use morelinq ToDataTable extension for converting personList to DataTable. | |
// Assign the converted Datatable to BindingSource's DataSource. | |
personBindingSource.DataSource = personList.ToDataTable(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) | |
{ | |
string filterStatus = DataGridViewAutoFilterColumnHeaderCell.GetFilterStatus(dataGridView1); | |
if (string.IsNullOrEmpty(filterStatus)) | |
{ | |
ShowAllLabel.Visible = false; | |
FilterStatusLabel.Visible = false; | |
} | |
else | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void dataGridView1_KeyDown(object sender, KeyEventArgs e) | |
{ | |
if (e.Alt | |
&& (e.KeyCode == Keys.Down || e.KeyCode == Keys.Up) | |
&& dataGridView1.CurrentCell != null | |
&& dataGridView1.CurrentCell.OwningColumn.HeaderCell is DataGridViewAutoFilterColumnHeaderCell filterCell) | |
{ | |
filterCell.ShowDropDownList(); | |
e.Handled = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using DataGridViewAutoFilter; | |
using MoreLinq; | |
using System; | |
using System.Collections.Generic; | |
using System.Windows.Forms; | |
namespace TestApp | |
{ | |
public partial class Form1 : Form | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
/// A Custom Dialog that displays a single question & list of answers. | |
class MultiSelectDialog extends StatelessWidget { | |
/// List to display the answer. | |
final List<String> answers; | |
/// Widget to display the question. | |
final Widget question; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:multiple_selection_dialogue_app/widgets/multi_select_dialog.dart'; | |
/// A demo page that displays an [ElevatedButton] | |
class DemoPage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
/// Stores the selected flavours | |
List<String> flavours = []; |
OlderNewer