diff --git a/FluentListView/CellEditing/CellEditKeyEngine.cs b/FluentListView/CellEditing/CellEditKeyEngine.cs
index 23eecb8..c91fa64 100644
--- a/FluentListView/CellEditing/CellEditKeyEngine.cs
+++ b/FluentListView/CellEditing/CellEditKeyEngine.cs
@@ -37,6 +37,7 @@
using System.Text;
using System.Windows.Forms;
using Fluent;
+using Fluent.Lists;
namespace Fluent {
///
diff --git a/FluentListView/CellEditing/CellEditors.cs b/FluentListView/CellEditing/CellEditors.cs
index 03f362a..63b0798 100644
--- a/FluentListView/CellEditing/CellEditors.cs
+++ b/FluentListView/CellEditing/CellEditors.cs
@@ -40,6 +40,7 @@
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/DragDrop/DragSource.cs b/FluentListView/DragDrop/DragSource.cs
index 2894465..4736034 100644
--- a/FluentListView/DragDrop/DragSource.cs
+++ b/FluentListView/DragDrop/DragSource.cs
@@ -38,6 +38,7 @@
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/DragDrop/DropSink.cs b/FluentListView/DragDrop/DropSink.cs
index f669a7e..e81908f 100644
--- a/FluentListView/DragDrop/DropSink.cs
+++ b/FluentListView/DragDrop/DropSink.cs
@@ -49,6 +49,7 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/DragDrop/OLVDataObject.cs b/FluentListView/DragDrop/OLVDataObject.cs
index 98181e3..a5238e8 100644
--- a/FluentListView/DragDrop/OLVDataObject.cs
+++ b/FluentListView/DragDrop/OLVDataObject.cs
@@ -34,6 +34,7 @@
using System;
using System.Collections;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Filtering/FilterMenuBuilder.cs b/FluentListView/Filtering/FilterMenuBuilder.cs
index cd63ada..5d0f9be 100644
--- a/FluentListView/Filtering/FilterMenuBuilder.cs
+++ b/FluentListView/Filtering/FilterMenuBuilder.cs
@@ -38,6 +38,7 @@
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Filtering/Filters.cs b/FluentListView/Filtering/Filters.cs
index b099ead..6197641 100644
--- a/FluentListView/Filtering/Filters.cs
+++ b/FluentListView/Filtering/Filters.cs
@@ -37,6 +37,7 @@
using System.Data;
using System.Reflection;
using System.Drawing;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Filtering/TextMatchFilter.cs b/FluentListView/Filtering/TextMatchFilter.cs
index b6a2bbe..70dc291 100644
--- a/FluentListView/Filtering/TextMatchFilter.cs
+++ b/FluentListView/Filtering/TextMatchFilter.cs
@@ -37,6 +37,7 @@
using System.Text;
using System.Text.RegularExpressions;
using System.Drawing;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/FluentListProperties.cs b/FluentListView/FluentListProperties.cs
new file mode 100644
index 0000000..71c7414
--- /dev/null
+++ b/FluentListView/FluentListProperties.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace Fluent {
+ public class FluentListProperties {
+
+ public string Name { get; set; }
+
+ public string Description { get; set; }
+
+ public string Icon { get; set; }
+
+ public List Columns { get; set; }
+
+ public string GroupBy { get; set; }
+
+
+
+ }
+}
diff --git a/FluentListView/FluentListView.DesignTime.cs b/FluentListView/FluentListView.DesignTime.cs
index 6516b1b..83eff2f 100644
--- a/FluentListView/FluentListView.DesignTime.cs
+++ b/FluentListView/FluentListView.DesignTime.cs
@@ -44,6 +44,7 @@
using System.Reflection;
using System.Windows.Forms;
using System.Windows.Forms.Design;
+using Fluent.Lists;
namespace Fluent.Design
{
diff --git a/FluentListView/FluentListView.cs b/FluentListView/FluentListView.cs
index 6cbb2dd..ae8e469 100644
--- a/FluentListView/FluentListView.cs
+++ b/FluentListView/FluentListView.cs
@@ -1,41 +1,440 @@
using System;
+using System.Collections;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using Fluent.Lists;
+using System.Linq;
namespace Fluent {
///
/// FluentListView is a C# wrapper around a .NET ListView, supporting model-bound lists,
/// in-place item editing, drag and drop, icons, themes, trees & data grids, and much more.
- /// This is a fork of ObjectListView with a focus on performance.
+ ///
+ /// If required, an AdvancedListView is created internally, otherwise a lightweight FastListView is created.
///
- public class FluentListView : UserControl {
+ public class FluentListView : UserControl {
- private AdvancedListView advList;
- private FastListView fastList;
- private IEnumerable items = new List();
+ private AdvancedListView InnerAdvList;
+ private FastListView InnerFastList;
+ private IList items = new List
+ public Action> OnDroppedFiles;
+ ///
+ /// You need to set this if you are using drag or drag-drop.
+ ///
+ public DropTargetLocation EnableDropOnLocations;
+
+
+
+
+ ///
+ /// WIP. Will show an icon near the name.
+ ///
+ public bool ShowIcons { get; set; }
+ ///
+ /// WIP. Will show a description line below the name.
+ ///
+ public bool ShowDescription { get; set; }
+ ///
+ /// Used to control if additional columns are displayed based on Properties.Columns.
+ ///
+ public bool ShowColumns { get; set; }
+ ///
+ /// WIP. Will group up the items on a given property.
+ ///
+ public bool ShowGroups { get; set; }
+ ///
+ /// WIP. Only used to select between AdvancedListView and FastListView.
+ ///
+ public bool EnableGifs { get; set; }
+ ///
+ /// WIP. Only used to select between AdvancedListView and FastListView.
+ ///
+ public bool EnableTileView { get; set; }
+ ///
+ /// WIP. Only used to select between AdvancedListView and FastListView.
+ ///
+ public bool EnableRenaming { get; set; }
+ ///
+ /// WIP. Only used to select between AdvancedListView and FastListView.
+ ///
+ public bool EnableCellEditing { get; set; }
+
+ ///
+ /// Gets the underlying AdvancedListView or FastListView UI control.
+ ///
+ [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
+ public AdvancedListView InnerList {
+ get {
+ if (InnerAdvList != null) {
+ return InnerAdvList;
+ }
+
+ if (InnerFastList != null) {
+ return InnerFastList;
+ }
+
+ return null;
+ }
+ }
+
+
///
/// Displays the items as a list. Items that are already created are re-used.
///
public void Redraw() {
+ if (items == null) {
+ return;
+ }
+
+ CreateDestroyList();
+
+ RedrawItems();
+
+ }
+
+ private void RedrawItems() {
+
+ this.SuspendLayout();
+
+ if (InnerAdvList != null) {
+ InnerAdvList.SetObjects(items);
+ }
+
+ if (InnerFastList != null) {
+ InnerFastList.SetObjects(items);
+ }
+
+ this.ResumeLayout();
+
+ }
+
+ private void CreateDestroyList() {
+
+ this.SuspendLayout();
+
+ if (ShouldCreateAdvancedListView()) {
+
+ // create advanced list if required
+ if (InnerAdvList == null) {
+ InnerAdvList = new AdvancedListView();
+ ConfigureList(InnerAdvList);
+ }
+
+ // destroy fast list if created
+ if (InnerFastList != null) {
+ this.Controls.Remove(InnerFastList);
+ InnerFastList.Dispose();
+ InnerFastList = null;
+ }
+
+ } else {
+
+ // else create fast list
+ if (InnerFastList == null) {
+ InnerFastList = new FastListView();
+ ConfigureList(InnerFastList);
+ }
+
+ // destroy advanced list if created
+ if (InnerAdvList != null) {
+ this.Controls.Remove(InnerAdvList);
+ InnerAdvList.Dispose();
+ InnerAdvList = null;
+ }
+ }
+
+ this.ResumeLayout();
+
+ }
+
+ private bool ShouldCreateAdvancedListView() {
+ return EnableGifs || EnableTileView || EnableRenaming || EnableCellEditing;
}
+ private void ConfigureList(AdvancedListView list) {
+
+ // basics
+ list.Size = this.Size;
+ list.Name = "InnerList";
+ list.Visible = true;
+
+ // add headers
+ var showHeaders = false;
+ list.AllColumns = GetColumns(out showHeaders);
+ list.RebuildColumns();
+
+ // setup header view
+ list.ShowHeaderInAllViews = showHeaders;
+ if (!showHeaders) {
+ list.HeaderStyle = ColumnHeaderStyle.None;
+ }
+
+ // setup view
+ list.View = View.Details;
+ list.FullRowSelect = true;
+ list.UseExplorerTheme = true;
+
+ // setup theme
+ if (Theme == OLVTheme.Vista) {
+ list.UseTranslucentSelection = true;
+ list.UseTranslucentHotItem = true;
+ } else if (Theme == OLVTheme.VistaExplorer) {
+ list.UseExplorerTheme = true;
+ }
+ if (ItemFont != null) {
+ list.Font = ItemFont;
+ }
+
+ // add and resize
+ this.Controls.Add(list);
+ list.Dock = DockStyle.Fill;
+ list.AutoSizeColumns();
+ list.AutoResizeColumns();
+
+ // configure drag & drop
+ if (EnableDragDropItems) {
+ list.IsSimpleDragSource = true;
+ }
+ if (EnableDragDropItems || EnableDrop || EnableDropFiles) {
+
+ // drop locations allowed
+ list.AllowDrop = true;
+ list.IsSimpleDropSink = true;
+ ((SimpleDropSink)list.DropSink).AcceptableLocations = EnableDropOnLocations;
+ ((SimpleDropSink)list.DropSink).CanDropOnBackground = Enum.IsDefined(typeof(DropTargetLocation), DropTargetLocation.Background);
+
+ // drop event handling
+ list.CanDrop += delegate (object sender, OlvDropEventArgs args) {
+
+ // if dropping files is enabled, internally manage the drop handling of files
+ if (EnableDropFiles) {
+ var files = GetDroppedFiles(args);
+ if (files != null) {
+ args.Effect = DragDropEffects.Copy;
+ return;
+ }
+ }
+
+ // call the user handler for drag/drop
+ if (OnCanDrop != null) {
+ var drop = OnCanDrop(args);
+ if (drop) {
+ args.Effect = DragDropEffects.Copy;
+ return;
+ }
+ }
+ };
+
+ // when dropped
+ list.Dropped += delegate (object sender, OlvDropEventArgs args) {
+
+ // if dropping files is enabled, internally manage the drop handling of files
+ if (EnableDropFiles) {
+ var files = GetDroppedFiles(args);
+ if (files != null) {
+ if (OnDroppedFiles != null) {
+ OnDroppedFiles(files);
+ }
+ }
+ }
+
+ // call the user handler for drag/drop
+ if (OnDropped != null) {
+ OnDropped(args);
+ }
+ };
+ }
+ }
+
+ private List GetColumns(out bool showHeaders) {
+ var columns = new List();
+
+ // ensure valid values given
+ if (Properties.Name == null) {
+ throw new ArgumentNullException("You need to set 'FluentListView.Properties.Name' to the property you wish to use as the display text for the objects! Set it to a blank string to call the ToString() method on the objects.");
+ }
+ if (ShowIcons && properties.Icon == null) {
+ throw new ArgumentNullException("You need to set 'FluentListView.Properties.Icon' to the property that contains an Icon or Bitmap object for the objects!");
+ }
+ if (ShowDescription && properties.Description == null) {
+ throw new ArgumentNullException("You need to set 'FluentListView.Properties.Description' to the property you wish to use as the description text for the objects!");
+ }
+
+ // always add a name property
+ columns.Add(new OLVColumn {
+ Name = "Name",
+ FillsFreeSpace = !ShowColumns,
+ Groupable = (Properties.GroupBy == Properties.Name),
+ UseInitialLetterForGroup = true,
+ AspectName = properties.Name,
+ IsVisible = true,
+ Width = 300,
+ });
+ showHeaders = false;
+
+ // add icon
+ if (ShowIcons) {
+ }
+
+ // add description
+ if (ShowDescription) {
+ }
+
+ // add columns
+ if (ShowColumns && properties.Columns != null) {
+ showHeaders = true;
+ foreach (var column in properties.Columns) {
+ columns.Add(new OLVColumn {
+ Name = column,
+ Groupable = (Properties.GroupBy == column),
+ AspectName = column,
+ IsVisible = true,
+ Width = 100,
+ });
+ }
+ }
+ return columns;
+ }
+
+ ///
+ /// Quickly adds an item to the list.
+ ///
+ public void AddItem(object item) {
+
+ items.Add(item);
+
+ // redraw the whole list if never done it before
+ if (InnerAdvList == null && InnerFastList == null) {
+ Redraw();
+ } else {
+
+ // quickly just add the object to the list
+ if (InnerAdvList != null) {
+ InnerAdvList.AddObject(item);
+ }
+ if (InnerFastList != null) {
+ InnerFastList.AddObject(item);
+ }
+
+ }
+
+ }
+ ///
+ /// Quickly removes an item from the list.
+ ///
+ public void RemoveItem(object item) {
+
+ // if the item is found in the array
+ if (items.Contains(item)) {
+ items.Remove(item);
+
+ // redraw the whole list if never done it before
+ if (InnerAdvList == null && InnerFastList == null) {
+ Redraw();
+ } else {
+
+ // quickly just add the object to the list
+ if (InnerAdvList != null) {
+ InnerAdvList.RemoveObject(item);
+ }
+ if (InnerFastList != null) {
+ InnerFastList.RemoveObject(item);
+ }
+
+ }
+ }
+
+ }
+
+ ///
+ /// Returns an array of file paths, when given an argument object recieved by the OnCanDrop and OnDropped events.
+ ///
+ ///
+ ///
+ public List GetDroppedFiles(OlvDropEventArgs args) {
+ try {
+ return ((string[])args.DragEventArgs.Data.GetData(DataFormats.FileDrop)).ToList();
+ } catch (Exception) {
+ }
+ return null;
+ }
+
+ }
+
+ public enum OLVTheme {
+ ///
+ /// This will style your list like the old Windows XP theme.
+ ///
+ XP = 1,
+ ///
+ /// This will give a selection and hot item mechanism that is similar to that used by Vista. It is not the same, I know. Do not complain.
+ ///
+ Vista = 2,
+ ///
+ /// If you absolutely have to look like Vista, this is your property. But it only works on Windows Vista and later, and does not work well with AlternateRowBackColors or HotItemStyles.
+ ///
+ VistaExplorer = 3
}
-}
+
+
+}
\ No newline at end of file
diff --git a/FluentListView/FluentListView.csproj b/FluentListView/FluentListView.csproj
index bbc17a3..ef32fd3 100644
--- a/FluentListView/FluentListView.csproj
+++ b/FluentListView/FluentListView.csproj
@@ -15,7 +15,7 @@
3.5
- v2.0
+ v4.5trueolv-keyfile.snk
@@ -34,6 +34,7 @@
1falsebin\Debug\FluentListView.xml
+ falsepdbonly
@@ -44,25 +45,25 @@
4falsebin\Release\FluentListView.xml
+ false
+
-
- Component
-
+ UserControl
@@ -75,7 +76,6 @@
- Component
@@ -86,13 +86,8 @@
-
- Component
-
+
-
- Component
-
@@ -100,13 +95,10 @@
Component
-
- Component
-
-
+ Component
@@ -138,7 +130,7 @@
-
+ Component
@@ -151,14 +143,14 @@
Component
-
+ Component
-
+ Component
diff --git a/FluentListView/Implementation/DataSourceAdapter.cs b/FluentListView/Implementation/DataSourceAdapter.cs
index ead0f89..83d3dfc 100644
--- a/FluentListView/Implementation/DataSourceAdapter.cs
+++ b/FluentListView/Implementation/DataSourceAdapter.cs
@@ -39,6 +39,7 @@
using System.Data;
using System.Windows.Forms;
using System.Diagnostics;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Implementation/Enums.cs b/FluentListView/Implementation/Enums.cs
index 645fb06..9711960 100644
--- a/FluentListView/Implementation/Enums.cs
+++ b/FluentListView/Implementation/Enums.cs
@@ -29,76 +29,80 @@
using System.Collections.Generic;
using System.Text;
-namespace Fluent {
+namespace Fluent.Lists {
- public partial class AdvancedListView {
- ///
- /// How does a user indicate that they want to edit cells?
- ///
- public enum CellEditActivateMode {
- ///
- /// This list cannot be edited. F2 does nothing.
- ///
- None = 0,
+ public partial class AdvancedListView {
+ ///
+ /// How does a user indicate that they want to edit cells?
+ ///
+ public enum CellEditActivateMode {
+ ///
+ /// This list cannot be edited. F2 does nothing.
+ ///
+ None = 0,
+
+ ///
+ /// A single click on a subitem will edit the value. Single clicking the primary column,
+ /// selects the row just like normal. The user must press F2 to edit the primary column.
+ ///
+ SingleClick = 1,
- ///
- /// A single click on a subitem will edit the value. Single clicking the primary column,
- /// selects the row just like normal. The user must press F2 to edit the primary column.
- ///
- SingleClick = 1,
+ ///
+ /// Double clicking a subitem or the primary column will edit that cell.
+ /// F2 will edit the primary column.
+ ///
+ DoubleClick = 2,
- ///
- /// Double clicking a subitem or the primary column will edit that cell.
- /// F2 will edit the primary column.
- ///
- DoubleClick = 2,
+ ///
+ /// Pressing F2 is the only way to edit the cells. Once the primary column is being edited,
+ /// the other cells in the row can be edited by pressing Tab.
+ ///
+ F2Only = 3,
- ///
- /// Pressing F2 is the only way to edit the cells. Once the primary column is being edited,
- /// the other cells in the row can be edited by pressing Tab.
- ///
- F2Only = 3,
+ ///
+ /// A single click on a any cell will edit the value, even the primary column.
+ ///
+ SingleClickAlways = 4,
+ }
- ///
- /// A single click on a any cell will edit the value, even the primary column.
- ///
- SingleClickAlways = 4,
- }
+ }
+}
+namespace Fluent {
+
+ ///
+ /// These values specify how column selection will be presented to the user
+ ///
+ public enum ColumnSelectBehaviour {
///
- /// These values specify how column selection will be presented to the user
+ /// No column selection will be presented
///
- public enum ColumnSelectBehaviour {
- ///
- /// No column selection will be presented
- ///
- None,
+ None,
- ///
- /// The columns will be show in the main menu
- ///
- InlineMenu,
+ ///
+ /// The columns will be show in the main menu
+ ///
+ InlineMenu,
- ///
- /// The columns will be shown in a submenu
- ///
- Submenu,
+ ///
+ /// The columns will be shown in a submenu
+ ///
+ Submenu,
- ///
- /// A model dialog will be presented to allow the user to choose columns
- ///
- ModelDialog,
+ ///
+ /// A model dialog will be presented to allow the user to choose columns
+ ///
+ ModelDialog,
- /*
- * NonModelDialog is just a little bit tricky since the OLV can change views while the dialog is showing
- * So, just comment this out for the time being.
+ /*
+ * NonModelDialog is just a little bit tricky since the OLV can change views while the dialog is showing
+ * So, just comment this out for the time being.
- ///
- /// A non-model dialog will be presented to allow the user to choose columns
- ///
- NonModelDialog
- *
- */
- }
+ ///
+ /// A non-model dialog will be presented to allow the user to choose columns
+ ///
+ NonModelDialog
+ *
+ */
}
}
\ No newline at end of file
diff --git a/FluentListView/Implementation/Events.cs b/FluentListView/Implementation/Events.cs
index 7b81a59..3870df8 100644
--- a/FluentListView/Implementation/Events.cs
+++ b/FluentListView/Implementation/Events.cs
@@ -57,828 +57,828 @@
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
+using Fluent.Lists;
+
+namespace Fluent.Lists {
+
+ public partial class AdvancedListView {
+ //-----------------------------------------------------------------------------------
+ #region Events
+
+ ///
+ /// Triggered after a FluentListView has been searched by the user typing into the list
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered after the control has done a search-by-typing action.")]
+ public event EventHandler AfterSearching;
+
+ ///
+ /// Triggered after a FluentListView has been sorted
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered after the items in the list have been sorted.")]
+ public event EventHandler AfterSorting;
+
+ ///
+ /// Triggered before a FluentListView is searched by the user typing into the list
+ ///
+ ///
+ /// Set Cancelled to true to prevent the searching from taking place.
+ /// Changing StringToFind or StartSearchFrom will change the subsequent search.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered before the control does a search-by-typing action.")]
+ public event EventHandler BeforeSearching;
+
+ ///
+ /// Triggered before a FluentListView is sorted
+ ///
+ ///
+ /// Set Cancelled to true to prevent the sort from taking place.
+ /// Changing ColumnToSort or SortOrder will change the subsequent sort.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered before the items in the list are sorted.")]
+ public event EventHandler BeforeSorting;
+
+ ///
+ /// Triggered after a FluentListView has created groups
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered after the groups are created.")]
+ public event EventHandler AfterCreatingGroups;
+
+ ///
+ /// Triggered before a FluentListView begins to create groups
+ ///
+ ///
+ /// Set Groups to prevent the default group creation process
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered before the groups are created.")]
+ public event EventHandler BeforeCreatingGroups;
+
+ ///
+ /// Triggered just before a FluentListView creates groups
+ ///
+ ///
+ /// You can make changes to the groups, which have been created, before those
+ /// groups are created within the listview.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the groups are just about to be created.")]
+ public event EventHandler AboutToCreateGroups;
+
+ ///
+ /// Triggered when a button in a cell is left clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the user left clicks a button.")]
+ public event EventHandler ButtonClick;
+
+ ///
+ /// This event is triggered when the user moves a drag over an FluentListView that
+ /// has a SimpleDropSink installed as the drop handler.
+ ///
+ ///
+ /// Handlers for this event should set the Effect argument and optionally the
+ /// InfoMsg property. They can also change any of the DropTarget* setttings to change
+ /// the target of the drop.
+ ///
+ [Category("FluentListView"),
+ Description("Can the user drop the currently dragged items at the current mouse location?")]
+ public event EventHandler CanDrop;
+
+ ///
+ /// Triggered when a cell has finished being edited.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered cell edit operation has completely finished")]
+ public event CellEditEventHandler CellEditFinished;
+
+ ///
+ /// Triggered when a cell is about to finish being edited.
+ ///
+ /// If Cancel is already true, the user is cancelling the edit operation.
+ /// Set Cancel to true to prevent the value from the cell being written into the model.
+ /// You cannot prevent the editing from finishing within this event -- you need
+ /// the CellEditValidating event for that.
+ [Category("FluentListView"),
+ Description("This event is triggered cell edit operation is finishing.")]
+ public event CellEditEventHandler CellEditFinishing;
+
+ ///
+ /// Triggered when a cell is about to be edited.
+ ///
+ /// Set Cancel to true to prevent the cell being edited.
+ /// You can change the the Control to be something completely different.
+ [Category("FluentListView"),
+ Description("This event is triggered when cell edit is about to begin.")]
+ public event CellEditEventHandler CellEditStarting;
+
+ ///
+ /// Triggered when a cell editor needs to be validated
+ ///
+ ///
+ /// If this event is cancelled, focus will remain on the cell editor.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a cell editor is about to lose focus and its new contents need to be validated.")]
+ public event CellEditEventHandler CellEditValidating;
+
+ ///
+ /// Triggered when a cell is left clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the user left clicks a cell.")]
+ public event EventHandler CellClick;
+
+ ///
+ /// Triggered when the mouse is above a cell.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the mouse is over a cell.")]
+ public event EventHandler CellOver;
+
+ ///
+ /// Triggered when a cell is right clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the user right clicks a cell.")]
+ public event EventHandler CellRightClick;
+
+ ///
+ /// This event is triggered when a cell needs a tool tip.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a cell needs a tool tip.")]
+ public event EventHandler CellToolTipShowing;
+
+ ///
+ /// This event is triggered when a checkbox is checked/unchecked on a subitem
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a checkbox is checked/unchecked on a subitem.")]
+ public event EventHandler SubItemChecking;
+
+ ///
+ /// Triggered when a column header is right clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the user right clicks a column header.")]
+ public event ColumnRightClickEventHandler ColumnRightClick;
+
+ ///
+ /// This event is triggered when the user releases a drag over an FluentListView that
+ /// has a SimpleDropSink installed as the drop handler.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the user dropped items onto the control.")]
+ public event EventHandler Dropped;
+
+ ///
+ /// This event is triggered when the control needs to filter its collection of objects.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the control needs to filter its collection of objects.")]
+ public event EventHandler Filter;
+
+ ///
+ /// This event is triggered when a cell needs to be formatted.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a cell needs to be formatted.")]
+ public event EventHandler FormatCell;
+
+ ///
+ /// This event is triggered when the frozeness of the control changes.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when frozeness of the control changes.")]
+ public event EventHandler Freezing;
+
+ ///
+ /// This event is triggered when a row needs to be formatted.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a row needs to be formatted.")]
+ public event EventHandler FormatRow;
+
+ ///
+ /// This event is triggered when a group is about to collapse or expand.
+ /// This can be cancelled to prevent the expansion.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a group is about to collapse or expand.")]
+ public event EventHandler GroupExpandingCollapsing;
+
+ ///
+ /// This event is triggered when a group changes state.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a group changes state.")]
+ public event EventHandler GroupStateChanged;
+
+ ///
+ /// This event is triggered when a header checkbox is changing value
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a header checkbox changes value.")]
+ public event EventHandler HeaderCheckBoxChanging;
+
+ ///
+ /// This event is triggered when a header needs a tool tip.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a header needs a tool tip.")]
+ public event EventHandler HeaderToolTipShowing;
+
+ ///
+ /// Triggered when the "hot" item changes
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the hot item changed.")]
+ public event EventHandler HotItemChanged;
+
+ ///
+ /// Triggered when a hyperlink cell is clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a hyperlink cell is clicked.")]
+ public event EventHandler HyperlinkClicked;
+
+ ///
+ /// Triggered when the task text of a group is clicked.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the task text of a group is clicked.")]
+ public event EventHandler GroupTaskClicked;
+
+ ///
+ /// Is the value in the given cell a hyperlink.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the control needs to know if a given cell contains a hyperlink.")]
+ public event EventHandler IsHyperlink;
+
+ ///
+ /// Some new objects are about to be added to an FluentListView.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when objects are about to be added to the control")]
+ public event EventHandler ItemsAdding;
+
+ ///
+ /// The contents of the FluentListView has changed.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the contents of the control have changed.")]
+ public event EventHandler ItemsChanged;
+
+ ///
+ /// The contents of the FluentListView is about to change via a SetObjects call
+ ///
+ ///
+ /// Set Cancelled to true to prevent the contents of the list changing. This does not work with virtual lists.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the contents of the control changes.")]
+ public event EventHandler ItemsChanging;
+
+ ///
+ /// Some objects are about to be removed from an FluentListView.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when objects are removed from the control.")]
+ public event EventHandler ItemsRemoving;
+
+ ///
+ /// This event is triggered when the user moves a drag over an FluentListView that
+ /// has a SimpleDropSink installed as the drop handler, and when the source control
+ /// for the drag was an FluentListView.
+ ///
+ ///
+ /// Handlers for this event should set the Effect argument and optionally the
+ /// InfoMsg property. They can also change any of the DropTarget* setttings to change
+ /// the target of the drop.
+ ///
+ [Category("FluentListView"),
+ Description("Can the dragged collection of model objects be dropped at the current mouse location")]
+ public event EventHandler ModelCanDrop;
+
+ ///
+ /// This event is triggered when the user releases a drag over an FluentListView that
+ /// has a SimpleDropSink installed as the drop handler and when the source control
+ /// for the drag was an FluentListView.
+ ///
+ [Category("FluentListView"),
+ Description("A collection of model objects from a FluentListView has been dropped on this control")]
+ public event EventHandler ModelDropped;
+
+ ///
+ /// This event is triggered once per user action that changes the selection state
+ /// of one or more rows.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered once per user action that changes the selection state of one or more rows.")]
+ public event EventHandler SelectionChanged;
+
+ ///
+ /// This event is triggered when the contents of the FluentListView has scrolled.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when the contents of the FluentListView has scrolled.")]
+ public event EventHandler Scroll;
+
+ #endregion
+
+ //-----------------------------------------------------------------------------------
+ #region OnEvents
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnAboutToCreateGroups(CreateGroupsEventArgs e) {
+ if (this.AboutToCreateGroups != null)
+ this.AboutToCreateGroups(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnBeforeCreatingGroups(CreateGroupsEventArgs e) {
+ if (this.BeforeCreatingGroups != null)
+ this.BeforeCreatingGroups(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnAfterCreatingGroups(CreateGroupsEventArgs e) {
+ if (this.AfterCreatingGroups != null)
+ this.AfterCreatingGroups(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnAfterSearching(AfterSearchingEventArgs e) {
+ if (this.AfterSearching != null)
+ this.AfterSearching(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnAfterSorting(AfterSortingEventArgs e) {
+ if (this.AfterSorting != null)
+ this.AfterSorting(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnBeforeSearching(BeforeSearchingEventArgs e) {
+ if (this.BeforeSearching != null)
+ this.BeforeSearching(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnBeforeSorting(BeforeSortingEventArgs e) {
+ if (this.BeforeSorting != null)
+ this.BeforeSorting(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnButtonClick(CellClickEventArgs args) {
+ if (this.ButtonClick != null)
+ this.ButtonClick(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnCanDrop(OlvDropEventArgs args) {
+ if (this.CanDrop != null)
+ this.CanDrop(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnCellClick(CellClickEventArgs args) {
+ if (this.CellClick != null)
+ this.CellClick(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnCellOver(CellOverEventArgs args) {
+ if (this.CellOver != null)
+ this.CellOver(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnCellRightClick(CellRightClickEventArgs args) {
+ if (this.CellRightClick != null)
+ this.CellRightClick(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnCellToolTip(ToolTipShowingEventArgs args) {
+ if (this.CellToolTipShowing != null)
+ this.CellToolTipShowing(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnSubItemChecking(SubItemCheckingEventArgs args) {
+ if (this.SubItemChecking != null)
+ this.SubItemChecking(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnColumnRightClick(ColumnClickEventArgs e) {
+ if (this.ColumnRightClick != null)
+ this.ColumnRightClick(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnDropped(OlvDropEventArgs args) {
+ if (this.Dropped != null)
+ this.Dropped(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ internal protected virtual void OnFilter(FilterEventArgs e) {
+ if (this.Filter != null)
+ this.Filter(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnFormatCell(FormatCellEventArgs args) {
+ if (this.FormatCell != null)
+ this.FormatCell(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnFormatRow(FormatRowEventArgs args) {
+ if (this.FormatRow != null)
+ this.FormatRow(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnFreezing(FreezeEventArgs args) {
+ if (this.Freezing != null)
+ this.Freezing(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnGroupExpandingCollapsing(GroupExpandingCollapsingEventArgs args) {
+ if (this.GroupExpandingCollapsing != null)
+ this.GroupExpandingCollapsing(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnGroupStateChanged(GroupStateChangedEventArgs args) {
+ if (this.GroupStateChanged != null)
+ this.GroupStateChanged(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnHeaderCheckBoxChanging(HeaderCheckBoxChangingEventArgs args) {
+ if (this.HeaderCheckBoxChanging != null)
+ this.HeaderCheckBoxChanging(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnHeaderToolTip(ToolTipShowingEventArgs args) {
+ if (this.HeaderToolTipShowing != null)
+ this.HeaderToolTipShowing(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnHotItemChanged(HotItemChangedEventArgs e) {
+ if (this.HotItemChanged != null)
+ this.HotItemChanged(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnHyperlinkClicked(HyperlinkClickedEventArgs e) {
+ if (this.HyperlinkClicked != null)
+ this.HyperlinkClicked(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnGroupTaskClicked(GroupTaskClickedEventArgs e) {
+ if (this.GroupTaskClicked != null)
+ this.GroupTaskClicked(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnIsHyperlink(IsHyperlinkEventArgs e) {
+ if (this.IsHyperlink != null)
+ this.IsHyperlink(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnItemsAdding(ItemsAddingEventArgs e) {
+ if (this.ItemsAdding != null)
+ this.ItemsAdding(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnItemsChanged(ItemsChangedEventArgs e) {
+ if (this.ItemsChanged != null)
+ this.ItemsChanged(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnItemsChanging(ItemsChangingEventArgs e) {
+ if (this.ItemsChanging != null)
+ this.ItemsChanging(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnItemsRemoving(ItemsRemovingEventArgs e) {
+ if (this.ItemsRemoving != null)
+ this.ItemsRemoving(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnModelCanDrop(ModelDropEventArgs args) {
+ if (this.ModelCanDrop != null)
+ this.ModelCanDrop(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnModelDropped(ModelDropEventArgs args) {
+ if (this.ModelDropped != null)
+ this.ModelDropped(this, args);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnSelectionChanged(EventArgs e) {
+ if (this.SelectionChanged != null)
+ this.SelectionChanged(this, e);
+ }
+
+ ///
+ ///
+ ///
+ ///
+ protected virtual void OnScroll(ScrollEventArgs e) {
+ if (this.Scroll != null)
+ this.Scroll(this, e);
+ }
+
+
+ ///
+ /// Tell the world when a cell is about to be edited.
+ ///
+ protected virtual void OnCellEditStarting(CellEditEventArgs e) {
+ if (this.CellEditStarting != null)
+ this.CellEditStarting(this, e);
+ }
+
+ ///
+ /// Tell the world when a cell is about to finish being edited.
+ ///
+ protected virtual void OnCellEditorValidating(CellEditEventArgs e) {
+ // Hack. ListView is an imperfect control container. It does not manage validation
+ // perfectly. If the ListView is part of a TabControl, and the cell editor loses
+ // focus by the user clicking on another tab, the TabControl processes the click
+ // and switches tabs, even if this Validating event cancels. This results in the
+ // strange situation where the cell editor is active, but isn't visible. When the
+ // user switches back to the tab with the ListView, composite controls like spin
+ // controls, DateTimePicker and ComboBoxes do not work properly. Specifically,
+ // keyboard input still works fine, but the controls do not respond to mouse
+ // input. SO, if the validation fails, we have to specifically give focus back to
+ // the cell editor. (this is the Select() call in the code below).
+ // But (there is always a 'but'), doing that changes the focus so the cell editor
+ // triggers another Validating event -- which fails again. From the user's point
+ // of view, they click away from the cell editor, and the validating code
+ // complains twice. So we only trigger a Validating event if more than 0.1 seconds
+ // has elapsed since the last validate event.
+ // I know it's a hack. I'm very open to hear a neater solution.
+
+ // Also, this timed response stops us from sending a series of validation events
+ // if the user clicks and holds on the OLV scroll bar.
+ //System.Diagnostics.Debug.WriteLine(Environment.TickCount - lastValidatingEvent);
+ if ((Environment.TickCount - lastValidatingEvent) < 100) {
+ e.Cancel = true;
+ } else {
+ lastValidatingEvent = Environment.TickCount;
+ if (this.CellEditValidating != null)
+ this.CellEditValidating(this, e);
+ }
+ lastValidatingEvent = Environment.TickCount;
+ }
+ private int lastValidatingEvent = 0;
+
+ ///
+ /// Tell the world when a cell is about to finish being edited.
+ ///
+ protected virtual void OnCellEditFinishing(CellEditEventArgs e) {
+ if (this.CellEditFinishing != null)
+ this.CellEditFinishing(this, e);
+ }
+
+ ///
+ /// Tell the world when a cell has finished being edited.
+ ///
+ protected virtual void OnCellEditFinished(CellEditEventArgs e) {
+ if (this.CellEditFinished != null)
+ this.CellEditFinished(this, e);
+ }
+
+ #endregion
+ }
+
+ public partial class TreeListView {
+
+ #region Events
+
+ ///
+ /// This event is triggered when user input requests the expansion of a list item.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a branch is about to expand.")]
+ public event EventHandler Expanding;
+
+ ///
+ /// This event is triggered when user input requests the collapse of a list item.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a branch is about to collapsed.")]
+ public event EventHandler Collapsing;
+
+ ///
+ /// This event is triggered after the expansion of a list item due to user input.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a branch has been expanded.")]
+ public event EventHandler Expanded;
+
+ ///
+ /// This event is triggered after the collapse of a list item due to user input.
+ ///
+ [Category("FluentListView"),
+ Description("This event is triggered when a branch has been collapsed.")]
+ public event EventHandler Collapsed;
+
+ #endregion
+
+ #region OnEvents
+
+ ///
+ /// Trigger the expanding event
+ ///
+ ///
+ protected virtual void OnExpanding(TreeBranchExpandingEventArgs e) {
+ if (this.Expanding != null)
+ this.Expanding(this, e);
+ }
+
+ ///
+ /// Trigger the collapsing event
+ ///
+ ///
+ protected virtual void OnCollapsing(TreeBranchCollapsingEventArgs e) {
+ if (this.Collapsing != null)
+ this.Collapsing(this, e);
+ }
+
+ ///
+ /// Trigger the expanded event
+ ///
+ ///
+ protected virtual void OnExpanded(TreeBranchExpandedEventArgs e) {
+ if (this.Expanded != null)
+ this.Expanded(this, e);
+ }
+
+ ///
+ /// Trigger the collapsed event
+ ///
+ ///
+ protected virtual void OnCollapsed(TreeBranchCollapsedEventArgs e) {
+ if (this.Collapsed != null)
+ this.Collapsed(this, e);
+ }
+
+ #endregion
+ }
+
+}
namespace Fluent
{
- ///
- /// The callbacks for CellEditing events
- ///
- /// this
- /// We could replace this with EventHandler<CellEditEventArgs> but that would break all
- /// cell editing event code from v1.x.
- ///
- public delegate void CellEditEventHandler(object sender, CellEditEventArgs e);
-
- public partial class AdvancedListView
- {
- //-----------------------------------------------------------------------------------
- #region Events
-
- ///
- /// Triggered after a FluentListView has been searched by the user typing into the list
- ///
- [Category("FluentListView"),
- Description("This event is triggered after the control has done a search-by-typing action.")]
- public event EventHandler AfterSearching;
-
- ///
- /// Triggered after a FluentListView has been sorted
- ///
- [Category("FluentListView"),
- Description("This event is triggered after the items in the list have been sorted.")]
- public event EventHandler AfterSorting;
-
- ///
- /// Triggered before a FluentListView is searched by the user typing into the list
- ///
- ///
- /// Set Cancelled to true to prevent the searching from taking place.
- /// Changing StringToFind or StartSearchFrom will change the subsequent search.
- ///
- [Category("FluentListView"),
- Description("This event is triggered before the control does a search-by-typing action.")]
- public event EventHandler BeforeSearching;
-
- ///
- /// Triggered before a FluentListView is sorted
- ///
- ///
- /// Set Cancelled to true to prevent the sort from taking place.
- /// Changing ColumnToSort or SortOrder will change the subsequent sort.
- ///
- [Category("FluentListView"),
- Description("This event is triggered before the items in the list are sorted.")]
- public event EventHandler BeforeSorting;
- ///
- /// Triggered after a FluentListView has created groups
- ///
- [Category("FluentListView"),
- Description("This event is triggered after the groups are created.")]
- public event EventHandler AfterCreatingGroups;
-
- ///
- /// Triggered before a FluentListView begins to create groups
- ///
- ///
- /// Set Groups to prevent the default group creation process
- ///
- [Category("FluentListView"),
- Description("This event is triggered before the groups are created.")]
- public event EventHandler BeforeCreatingGroups;
+ ///
+ /// The callbacks for CellEditing events
+ ///
+ /// this
+ /// We could replace this with EventHandler<CellEditEventArgs> but that would break all
+ /// cell editing event code from v1.x.
+ ///
+ public delegate void CellEditEventHandler(object sender, CellEditEventArgs e);
- ///
- /// Triggered just before a FluentListView creates groups
- ///
- ///
- /// You can make changes to the groups, which have been created, before those
- /// groups are created within the listview.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the groups are just about to be created.")]
- public event EventHandler AboutToCreateGroups;
- ///
- /// Triggered when a button in a cell is left clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the user left clicks a button.")]
- public event EventHandler ButtonClick;
-
- ///
- /// This event is triggered when the user moves a drag over an FluentListView that
- /// has a SimpleDropSink installed as the drop handler.
- ///
- ///
- /// Handlers for this event should set the Effect argument and optionally the
- /// InfoMsg property. They can also change any of the DropTarget* setttings to change
- /// the target of the drop.
- ///
- [Category("FluentListView"),
- Description("Can the user drop the currently dragged items at the current mouse location?")]
- public event EventHandler CanDrop;
-
- ///
- /// Triggered when a cell has finished being edited.
- ///
- [Category("FluentListView"),
- Description("This event is triggered cell edit operation has completely finished")]
- public event CellEditEventHandler CellEditFinished;
-
- ///
- /// Triggered when a cell is about to finish being edited.
- ///
- /// If Cancel is already true, the user is cancelling the edit operation.
- /// Set Cancel to true to prevent the value from the cell being written into the model.
- /// You cannot prevent the editing from finishing within this event -- you need
- /// the CellEditValidating event for that.
- [Category("FluentListView"),
- Description("This event is triggered cell edit operation is finishing.")]
- public event CellEditEventHandler CellEditFinishing;
-
- ///
- /// Triggered when a cell is about to be edited.
- ///
- /// Set Cancel to true to prevent the cell being edited.
- /// You can change the the Control to be something completely different.
- [Category("FluentListView"),
- Description("This event is triggered when cell edit is about to begin.")]
- public event CellEditEventHandler CellEditStarting;
-
- ///
- /// Triggered when a cell editor needs to be validated
- ///
- ///
- /// If this event is cancelled, focus will remain on the cell editor.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a cell editor is about to lose focus and its new contents need to be validated.")]
- public event CellEditEventHandler CellEditValidating;
-
- ///
- /// Triggered when a cell is left clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the user left clicks a cell.")]
- public event EventHandler CellClick;
-
- ///
- /// Triggered when the mouse is above a cell.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the mouse is over a cell.")]
- public event EventHandler CellOver;
-
- ///
- /// Triggered when a cell is right clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the user right clicks a cell.")]
- public event EventHandler CellRightClick;
-
- ///
- /// This event is triggered when a cell needs a tool tip.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a cell needs a tool tip.")]
- public event EventHandler CellToolTipShowing;
-
- ///
- /// This event is triggered when a checkbox is checked/unchecked on a subitem
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a checkbox is checked/unchecked on a subitem.")]
- public event EventHandler SubItemChecking;
-
- ///
- /// Triggered when a column header is right clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the user right clicks a column header.")]
- public event ColumnRightClickEventHandler ColumnRightClick;
-
- ///
- /// This event is triggered when the user releases a drag over an FluentListView that
- /// has a SimpleDropSink installed as the drop handler.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the user dropped items onto the control.")]
- public event EventHandler Dropped;
-
- ///
- /// This event is triggered when the control needs to filter its collection of objects.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the control needs to filter its collection of objects.")]
- public event EventHandler Filter;
-
- ///
- /// This event is triggered when a cell needs to be formatted.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a cell needs to be formatted.")]
- public event EventHandler FormatCell;
-
- ///
- /// This event is triggered when the frozeness of the control changes.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when frozeness of the control changes.")]
- public event EventHandler Freezing;
-
- ///
- /// This event is triggered when a row needs to be formatted.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a row needs to be formatted.")]
- public event EventHandler FormatRow;
-
- ///
- /// This event is triggered when a group is about to collapse or expand.
- /// This can be cancelled to prevent the expansion.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a group is about to collapse or expand.")]
- public event EventHandler GroupExpandingCollapsing;
-
- ///
- /// This event is triggered when a group changes state.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a group changes state.")]
- public event EventHandler GroupStateChanged;
-
- ///
- /// This event is triggered when a header checkbox is changing value
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a header checkbox changes value.")]
- public event EventHandler HeaderCheckBoxChanging;
-
- ///
- /// This event is triggered when a header needs a tool tip.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a header needs a tool tip.")]
- public event EventHandler HeaderToolTipShowing;
-
- ///
- /// Triggered when the "hot" item changes
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the hot item changed.")]
- public event EventHandler HotItemChanged;
-
- ///
- /// Triggered when a hyperlink cell is clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a hyperlink cell is clicked.")]
- public event EventHandler HyperlinkClicked;
-
- ///
- /// Triggered when the task text of a group is clicked.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the task text of a group is clicked.")]
- public event EventHandler GroupTaskClicked;
-
- ///
- /// Is the value in the given cell a hyperlink.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the control needs to know if a given cell contains a hyperlink.")]
- public event EventHandler IsHyperlink;
-
- ///
- /// Some new objects are about to be added to an FluentListView.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when objects are about to be added to the control")]
- public event EventHandler ItemsAdding;
-
- ///
- /// The contents of the FluentListView has changed.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the contents of the control have changed.")]
- public event EventHandler ItemsChanged;
-
- ///
- /// The contents of the FluentListView is about to change via a SetObjects call
- ///
- ///
- /// Set Cancelled to true to prevent the contents of the list changing. This does not work with virtual lists.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the contents of the control changes.")]
- public event EventHandler ItemsChanging;
-
- ///
- /// Some objects are about to be removed from an FluentListView.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when objects are removed from the control.")]
- public event EventHandler ItemsRemoving;
-
- ///
- /// This event is triggered when the user moves a drag over an FluentListView that
- /// has a SimpleDropSink installed as the drop handler, and when the source control
- /// for the drag was an FluentListView.
- ///
- ///
- /// Handlers for this event should set the Effect argument and optionally the
- /// InfoMsg property. They can also change any of the DropTarget* setttings to change
- /// the target of the drop.
- ///
- [Category("FluentListView"),
- Description("Can the dragged collection of model objects be dropped at the current mouse location")]
- public event EventHandler ModelCanDrop;
-
- ///
- /// This event is triggered when the user releases a drag over an FluentListView that
- /// has a SimpleDropSink installed as the drop handler and when the source control
- /// for the drag was an FluentListView.
- ///
- [Category("FluentListView"),
- Description("A collection of model objects from a FluentListView has been dropped on this control")]
- public event EventHandler ModelDropped;
-
- ///
- /// This event is triggered once per user action that changes the selection state
- /// of one or more rows.
- ///
- [Category("FluentListView"),
- Description("This event is triggered once per user action that changes the selection state of one or more rows.")]
- public event EventHandler SelectionChanged;
-
- ///
- /// This event is triggered when the contents of the FluentListView has scrolled.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when the contents of the FluentListView has scrolled.")]
- public event EventHandler Scroll;
-
- #endregion
-
- //-----------------------------------------------------------------------------------
- #region OnEvents
-
- ///
- ///
- ///
- ///
- protected virtual void OnAboutToCreateGroups(CreateGroupsEventArgs e) {
- if (this.AboutToCreateGroups != null)
- this.AboutToCreateGroups(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnBeforeCreatingGroups(CreateGroupsEventArgs e) {
- if (this.BeforeCreatingGroups != null)
- this.BeforeCreatingGroups(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnAfterCreatingGroups(CreateGroupsEventArgs e) {
- if (this.AfterCreatingGroups != null)
- this.AfterCreatingGroups(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnAfterSearching(AfterSearchingEventArgs e) {
- if (this.AfterSearching != null)
- this.AfterSearching(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnAfterSorting(AfterSortingEventArgs e) {
- if (this.AfterSorting != null)
- this.AfterSorting(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnBeforeSearching(BeforeSearchingEventArgs e) {
- if (this.BeforeSearching != null)
- this.BeforeSearching(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnBeforeSorting(BeforeSortingEventArgs e) {
- if (this.BeforeSorting != null)
- this.BeforeSorting(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnButtonClick(CellClickEventArgs args)
- {
- if (this.ButtonClick != null)
- this.ButtonClick(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnCanDrop(OlvDropEventArgs args) {
- if (this.CanDrop != null)
- this.CanDrop(this, args);
- }
+ //-----------------------------------------------------------------------------------
+ #region Event Parameter Blocks
- ///
- ///
- ///
- ///
- protected virtual void OnCellClick(CellClickEventArgs args) {
- if (this.CellClick != null)
- this.CellClick(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnCellOver(CellOverEventArgs args) {
- if (this.CellOver != null)
- this.CellOver(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnCellRightClick(CellRightClickEventArgs args) {
- if (this.CellRightClick != null)
- this.CellRightClick(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnCellToolTip(ToolTipShowingEventArgs args) {
- if (this.CellToolTipShowing != null)
- this.CellToolTipShowing(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnSubItemChecking(SubItemCheckingEventArgs args) {
- if (this.SubItemChecking != null)
- this.SubItemChecking(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnColumnRightClick(ColumnClickEventArgs e) {
- if (this.ColumnRightClick != null)
- this.ColumnRightClick(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnDropped(OlvDropEventArgs args) {
- if (this.Dropped != null)
- this.Dropped(this, args);
- }
-
- ///
- ///
- ///
- ///
- internal protected virtual void OnFilter(FilterEventArgs e) {
- if (this.Filter != null)
- this.Filter(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnFormatCell(FormatCellEventArgs args) {
- if (this.FormatCell != null)
- this.FormatCell(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnFormatRow(FormatRowEventArgs args) {
- if (this.FormatRow != null)
- this.FormatRow(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnFreezing(FreezeEventArgs args) {
- if (this.Freezing != null)
- this.Freezing(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnGroupExpandingCollapsing(GroupExpandingCollapsingEventArgs args)
- {
- if (this.GroupExpandingCollapsing != null)
- this.GroupExpandingCollapsing(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnGroupStateChanged(GroupStateChangedEventArgs args)
- {
- if (this.GroupStateChanged != null)
- this.GroupStateChanged(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnHeaderCheckBoxChanging(HeaderCheckBoxChangingEventArgs args)
- {
- if (this.HeaderCheckBoxChanging != null)
- this.HeaderCheckBoxChanging(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnHeaderToolTip(ToolTipShowingEventArgs args)
- {
- if (this.HeaderToolTipShowing != null)
- this.HeaderToolTipShowing(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnHotItemChanged(HotItemChangedEventArgs e) {
- if (this.HotItemChanged != null)
- this.HotItemChanged(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnHyperlinkClicked(HyperlinkClickedEventArgs e) {
- if (this.HyperlinkClicked != null)
- this.HyperlinkClicked(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnGroupTaskClicked(GroupTaskClickedEventArgs e) {
- if (this.GroupTaskClicked != null)
- this.GroupTaskClicked(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnIsHyperlink(IsHyperlinkEventArgs e) {
- if (this.IsHyperlink != null)
- this.IsHyperlink(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnItemsAdding(ItemsAddingEventArgs e) {
- if (this.ItemsAdding != null)
- this.ItemsAdding(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnItemsChanged(ItemsChangedEventArgs e) {
- if (this.ItemsChanged != null)
- this.ItemsChanged(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnItemsChanging(ItemsChangingEventArgs e) {
- if (this.ItemsChanging != null)
- this.ItemsChanging(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnItemsRemoving(ItemsRemovingEventArgs e) {
- if (this.ItemsRemoving != null)
- this.ItemsRemoving(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnModelCanDrop(ModelDropEventArgs args) {
- if (this.ModelCanDrop != null)
- this.ModelCanDrop(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnModelDropped(ModelDropEventArgs args) {
- if (this.ModelDropped != null)
- this.ModelDropped(this, args);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnSelectionChanged(EventArgs e) {
- if (this.SelectionChanged != null)
- this.SelectionChanged(this, e);
- }
-
- ///
- ///
- ///
- ///
- protected virtual void OnScroll(ScrollEventArgs e) {
- if (this.Scroll != null)
- this.Scroll(this, e);
- }
-
-
- ///
- /// Tell the world when a cell is about to be edited.
- ///
- protected virtual void OnCellEditStarting(CellEditEventArgs e) {
- if (this.CellEditStarting != null)
- this.CellEditStarting(this, e);
- }
-
- ///
- /// Tell the world when a cell is about to finish being edited.
- ///
- protected virtual void OnCellEditorValidating(CellEditEventArgs e) {
- // Hack. ListView is an imperfect control container. It does not manage validation
- // perfectly. If the ListView is part of a TabControl, and the cell editor loses
- // focus by the user clicking on another tab, the TabControl processes the click
- // and switches tabs, even if this Validating event cancels. This results in the
- // strange situation where the cell editor is active, but isn't visible. When the
- // user switches back to the tab with the ListView, composite controls like spin
- // controls, DateTimePicker and ComboBoxes do not work properly. Specifically,
- // keyboard input still works fine, but the controls do not respond to mouse
- // input. SO, if the validation fails, we have to specifically give focus back to
- // the cell editor. (this is the Select() call in the code below).
- // But (there is always a 'but'), doing that changes the focus so the cell editor
- // triggers another Validating event -- which fails again. From the user's point
- // of view, they click away from the cell editor, and the validating code
- // complains twice. So we only trigger a Validating event if more than 0.1 seconds
- // has elapsed since the last validate event.
- // I know it's a hack. I'm very open to hear a neater solution.
-
- // Also, this timed response stops us from sending a series of validation events
- // if the user clicks and holds on the OLV scroll bar.
- //System.Diagnostics.Debug.WriteLine(Environment.TickCount - lastValidatingEvent);
- if ((Environment.TickCount - lastValidatingEvent) < 100) {
- e.Cancel = true;
- } else {
- lastValidatingEvent = Environment.TickCount;
- if (this.CellEditValidating != null)
- this.CellEditValidating(this, e);
- }
- lastValidatingEvent = Environment.TickCount;
- }
- private int lastValidatingEvent = 0;
-
- ///
- /// Tell the world when a cell is about to finish being edited.
- ///
- protected virtual void OnCellEditFinishing(CellEditEventArgs e) {
- if (this.CellEditFinishing != null)
- this.CellEditFinishing(this, e);
- }
-
- ///
- /// Tell the world when a cell has finished being edited.
- ///
- protected virtual void OnCellEditFinished(CellEditEventArgs e) {
- if (this.CellEditFinished != null)
- this.CellEditFinished(this, e);
- }
-
- #endregion
- }
-
- public partial class TreeListView
- {
-
- #region Events
-
- ///
- /// This event is triggered when user input requests the expansion of a list item.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a branch is about to expand.")]
- public event EventHandler Expanding;
-
- ///
- /// This event is triggered when user input requests the collapse of a list item.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a branch is about to collapsed.")]
- public event EventHandler Collapsing;
-
- ///
- /// This event is triggered after the expansion of a list item due to user input.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a branch has been expanded.")]
- public event EventHandler Expanded;
-
- ///
- /// This event is triggered after the collapse of a list item due to user input.
- ///
- [Category("FluentListView"),
- Description("This event is triggered when a branch has been collapsed.")]
- public event EventHandler Collapsed;
-
- #endregion
-
- #region OnEvents
-
- ///
- /// Trigger the expanding event
- ///
- ///
- protected virtual void OnExpanding(TreeBranchExpandingEventArgs e) {
- if (this.Expanding != null)
- this.Expanding(this, e);
- }
-
- ///
- /// Trigger the collapsing event
- ///
- ///
- protected virtual void OnCollapsing(TreeBranchCollapsingEventArgs e) {
- if (this.Collapsing != null)
- this.Collapsing(this, e);
- }
-
- ///
- /// Trigger the expanded event
- ///
- ///
- protected virtual void OnExpanded(TreeBranchExpandedEventArgs e) {
- if (this.Expanded != null)
- this.Expanded(this, e);
- }
-
- ///
- /// Trigger the collapsed event
- ///
- ///
- protected virtual void OnCollapsed(TreeBranchCollapsedEventArgs e) {
- if (this.Collapsed != null)
- this.Collapsed(this, e);
- }
-
- #endregion
- }
-
- //-----------------------------------------------------------------------------------
- #region Event Parameter Blocks
-
- ///
- /// Let the world know that a cell edit operation is beginning or ending
- ///
- public class CellEditEventArgs : EventArgs
+ ///
+ /// Let the world know that a cell edit operation is beginning or ending
+ ///
+ public class CellEditEventArgs : EventArgs
{
///
/// Create an event args
diff --git a/FluentListView/Implementation/GroupingParameters.cs b/FluentListView/Implementation/GroupingParameters.cs
index 7c3dde0..fe48f54 100644
--- a/FluentListView/Implementation/GroupingParameters.cs
+++ b/FluentListView/Implementation/GroupingParameters.cs
@@ -29,6 +29,7 @@
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Implementation/Groups.cs b/FluentListView/Implementation/Groups.cs
index 0dd8234..c884591 100644
--- a/FluentListView/Implementation/Groups.cs
+++ b/FluentListView/Implementation/Groups.cs
@@ -39,6 +39,7 @@
using System.Reflection;
using System.Windows.Forms;
using System.Runtime.InteropServices;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Implementation/NativeMethods.cs b/FluentListView/Implementation/NativeMethods.cs
index d17bc4b..aa5c3b4 100644
--- a/FluentListView/Implementation/NativeMethods.cs
+++ b/FluentListView/Implementation/NativeMethods.cs
@@ -35,6 +35,7 @@
using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Implementation/OLVListItem.cs b/FluentListView/Implementation/OLVListItem.cs
index 4d56278..9fdeb6e 100644
--- a/FluentListView/Implementation/OLVListItem.cs
+++ b/FluentListView/Implementation/OLVListItem.cs
@@ -37,6 +37,7 @@
using System.Text;
using System.Windows.Forms;
using System.Drawing;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Implementation/OlvListViewHitTestInfo.cs b/FluentListView/Implementation/OlvListViewHitTestInfo.cs
index 3f78606..f007885 100644
--- a/FluentListView/Implementation/OlvListViewHitTestInfo.cs
+++ b/FluentListView/Implementation/OlvListViewHitTestInfo.cs
@@ -29,6 +29,7 @@
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Implementation/TreeDataSourceAdapter.cs b/FluentListView/Implementation/TreeDataSourceAdapter.cs
deleted file mode 100644
index 9682a17..0000000
--- a/FluentListView/Implementation/TreeDataSourceAdapter.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-using System;
-using System.Collections;
-using System.ComponentModel;
-using System.Diagnostics;
-
-namespace Fluent
-{
- ///
- /// A TreeDataSourceAdapter knows how to build a tree structure from a binding list.
- ///
- /// To build a tree
- public class TreeDataSourceAdapter : DataSourceAdapter
- {
- #region Life and death
-
- ///
- /// Create a data source adaptor that knows how to build a tree structure
- ///
- ///
- public TreeDataSourceAdapter(DataTreeListView tlv)
- : base(tlv) {
- this.treeListView = tlv;
- this.treeListView.CanExpandGetter = delegate(object model) { return this.CalculateHasChildren(model); };
- this.treeListView.ChildrenGetter = delegate(object model) { return this.CalculateChildren(model); };
- }
-
- #endregion
-
- #region Properties
-
- ///
- /// Gets or sets the name of the property/column that uniquely identifies each row.
- ///
- ///
- ///
- /// The value contained by this column must be unique across all rows
- /// in the data source. Odd and unpredictable things will happen if two
- /// rows have the same id.
- ///
- /// Null cannot be a valid key value.
- ///
- public virtual string KeyAspectName {
- get { return keyAspectName; }
- set {
- if (keyAspectName == value)
- return;
- keyAspectName = value;
- this.keyMunger = new Munger(this.KeyAspectName);
- this.InitializeDataSource();
- }
- }
- private string keyAspectName;
-
- ///
- /// Gets or sets the name of the property/column that contains the key of
- /// the parent of a row.
- ///
- ///
- ///
- /// The test condition for deciding if one row is the parent of another is functionally
- /// equivilent to this:
- ///
- /// Object.Equals(candidateParentRow[this.KeyAspectName], row[this.ParentKeyAspectName])
- ///
- ///
- /// Unlike key value, parent keys can be null but a null parent key can only be used
- /// to identify root objects.
- ///
- public virtual string ParentKeyAspectName {
- get { return parentKeyAspectName; }
- set {
- if (parentKeyAspectName == value)
- return;
- parentKeyAspectName = value;
- this.parentKeyMunger = new Munger(this.ParentKeyAspectName);
- this.InitializeDataSource();
- }
- }
- private string parentKeyAspectName;
-
- ///
- /// Gets or sets the value that identifies a row as a root object.
- /// When the ParentKey of a row equals the RootKeyValue, that row will
- /// be treated as root of the TreeListView.
- ///
- ///
- ///
- /// The test condition for deciding a root object is functionally
- /// equivilent to this:
- ///
- /// Object.Equals(candidateRow[this.ParentKeyAspectName], this.RootKeyValue)
- ///
- ///
- /// The RootKeyValue can be null.
- ///
- public virtual object RootKeyValue {
- get { return rootKeyValue; }
- set {
- if (Equals(rootKeyValue, value))
- return;
- rootKeyValue = value;
- this.InitializeDataSource();
- }
- }
- private object rootKeyValue;
-
- ///
- /// Gets or sets whether or not the key columns (id and parent id) should
- /// be shown to the user.
- ///
- /// This must be set before the DataSource is set. It has no effect
- /// afterwards.
- public virtual bool ShowKeyColumns {
- get { return showKeyColumns; }
- set { showKeyColumns = value; }
- }
- private bool showKeyColumns = true;
-
-
- #endregion
-
- #region Implementation properties
-
- ///
- /// Gets the DataTreeListView that is being managed
- ///
- protected DataTreeListView TreeListView {
- get { return treeListView; }
- }
- private readonly DataTreeListView treeListView;
-
- #endregion
-
- #region Implementation
-
- ///
- ///
- ///
- protected override void InitializeDataSource() {
- base.InitializeDataSource();
- this.TreeListView.RebuildAll(true);
- }
-
- ///
- ///
- ///
- protected override void SetListContents() {
- this.TreeListView.Roots = this.CalculateRoots();
- }
-
- ///
- ///
- ///
- ///
- ///
- protected override bool ShouldCreateColumn(PropertyDescriptor property) {
- // If the property is a key column, and we aren't supposed to show keys, don't show it
- if (!this.ShowKeyColumns && (property.Name == this.KeyAspectName || property.Name == this.ParentKeyAspectName))
- return false;
-
- return base.ShouldCreateColumn(property);
- }
-
- ///
- ///
- ///
- ///
- protected override void HandleListChangedItemChanged(System.ComponentModel.ListChangedEventArgs e) {
- // If the id or the parent id of a row changes, we just rebuild everything.
- // We can't do anything more specific. We don't know what the previous values, so we can't
- // tell the previous parent to refresh itself. If the id itself has changed, things that used
- // to be children will no longer be children. Just rebuild everything.
- // It seems PropertyDescriptor is only filled in .NET 4 :(
- if (e.PropertyDescriptor != null &&
- (e.PropertyDescriptor.Name == this.KeyAspectName ||
- e.PropertyDescriptor.Name == this.ParentKeyAspectName))
- this.InitializeDataSource();
- else
- base.HandleListChangedItemChanged(e);
- }
-
- ///
- ///
- ///
- ///
- protected override void ChangePosition(int index) {
- // We can't use our base method directly, since the normal position management
- // doesn't know about our tree structure. They treat our dataset as a flat list
- // but we have a collapsable structure. This means that the 5'th row to them
- // may not even be visible to us
-
- // To display the n'th row, we have to make sure that all its ancestors
- // are expanded. Then we will be able to select it.
- object model = this.CurrencyManager.List[index];
- object parent = this.CalculateParent(model);
- while (parent != null && !this.TreeListView.IsExpanded(parent)) {
- this.TreeListView.Expand(parent);
- parent = this.CalculateParent(parent);
- }
-
- base.ChangePosition(index);
- }
-
- private IEnumerable CalculateRoots() {
- foreach (object x in this.CurrencyManager.List) {
- object parentKey = this.GetParentValue(x);
- if (Object.Equals(this.RootKeyValue, parentKey))
- yield return x;
- }
- }
-
- private bool CalculateHasChildren(object model) {
- object keyValue = this.GetKeyValue(model);
- if (keyValue == null)
- return false;
-
- foreach (object x in this.CurrencyManager.List) {
- object parentKey = this.GetParentValue(x);
- if (Object.Equals(keyValue, parentKey))
- return true;
- }
- return false;
- }
-
- private IEnumerable CalculateChildren(object model) {
- object keyValue = this.GetKeyValue(model);
- if (keyValue != null) {
- foreach (object x in this.CurrencyManager.List) {
- object parentKey = this.GetParentValue(x);
- if (Object.Equals(keyValue, parentKey))
- yield return x;
- }
- }
- }
-
- private object CalculateParent(object model) {
- object parentValue = this.GetParentValue(model);
- if (parentValue == null)
- return null;
-
- foreach (object x in this.CurrencyManager.List) {
- object key = this.GetKeyValue(x);
- if (Object.Equals(parentValue, key))
- return x;
- }
- return null;
- }
-
- private object GetKeyValue(object model) {
- return this.keyMunger == null ? null : this.keyMunger.GetValue(model);
- }
-
- private object GetParentValue(object model) {
- return this.parentKeyMunger == null ? null : this.parentKeyMunger.GetValue(model);
- }
-
- #endregion
-
- private Munger keyMunger;
- private Munger parentKeyMunger;
- }
-}
\ No newline at end of file
diff --git a/FluentListView/Implementation/VirtualGroups.cs b/FluentListView/Implementation/VirtualGroups.cs
index 138cd68..5d2e28a 100644
--- a/FluentListView/Implementation/VirtualGroups.cs
+++ b/FluentListView/Implementation/VirtualGroups.cs
@@ -33,6 +33,7 @@
using System.Collections.Generic;
using System.Windows.Forms;
using System.Runtime.InteropServices;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Implementation/VirtualListDataSource.cs b/FluentListView/Implementation/VirtualListDataSource.cs
index a1e18e8..2666266 100644
--- a/FluentListView/Implementation/VirtualListDataSource.cs
+++ b/FluentListView/Implementation/VirtualListDataSource.cs
@@ -33,6 +33,7 @@
using System;
using System.Collections;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/AdvancedListView.cs b/FluentListView/Lists/AdvancedListView.cs
similarity index 99%
rename from FluentListView/AdvancedListView.cs
rename to FluentListView/Lists/AdvancedListView.cs
index 273802b..5b9450e 100644
--- a/FluentListView/AdvancedListView.cs
+++ b/FluentListView/Lists/AdvancedListView.cs
@@ -38,7 +38,7 @@
using System.Runtime.Serialization.Formatters;
using System.Threading;
-namespace Fluent
+namespace Fluent.Lists
{
///
/// An FluentListView is a much easier to use, and much more powerful, version of the ListView.
diff --git a/FluentListView/FastListView.cs b/FluentListView/Lists/FastListView.cs
similarity index 99%
rename from FluentListView/FastListView.cs
rename to FluentListView/Lists/FastListView.cs
index 8c8be5e..6bc601a 100644
--- a/FluentListView/FastListView.cs
+++ b/FluentListView/Lists/FastListView.cs
@@ -43,7 +43,7 @@
using System.ComponentModel;
using System.Windows.Forms;
-namespace Fluent
+namespace Fluent.Lists
{
///
/// A FastFluentListView trades function for speed.
diff --git a/FluentListView/TreeListView.cs b/FluentListView/Lists/TreeListView.cs
similarity index 99%
rename from FluentListView/TreeListView.cs
rename to FluentListView/Lists/TreeListView.cs
index b6e9b47..1bf22b2 100644
--- a/FluentListView/TreeListView.cs
+++ b/FluentListView/Lists/TreeListView.cs
@@ -127,8 +127,9 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Windows.Forms;
+using Fluent.Lists;
-namespace Fluent
+namespace Fluent.Lists
{
///
/// A TreeListView combines an expandable tree structure with list view columns.
diff --git a/FluentListView/VirtualFluentListView.cs b/FluentListView/Lists/VirtualFluentListView.cs
similarity index 99%
rename from FluentListView/VirtualFluentListView.cs
rename to FluentListView/Lists/VirtualFluentListView.cs
index e35e3b6..c0040ba 100644
--- a/FluentListView/VirtualFluentListView.cs
+++ b/FluentListView/Lists/VirtualFluentListView.cs
@@ -80,7 +80,7 @@
using System.Windows.Forms;
using System.Runtime.InteropServices;
-namespace Fluent
+namespace Fluent.Lists
{
///
/// A virtual object list view operates in virtual mode, that is, it only gets model objects for
diff --git a/FluentListView/OLVColumn.cs b/FluentListView/OLVColumn.cs
index bb0fff9..e659aff 100644
--- a/FluentListView/OLVColumn.cs
+++ b/FluentListView/OLVColumn.cs
@@ -37,6 +37,7 @@
using System.Collections;
using System.Diagnostics;
using System.Drawing.Design;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/Rendering/Decorations.cs b/FluentListView/Rendering/Decorations.cs
index 5eb90ba..9d83318 100644
--- a/FluentListView/Rendering/Decorations.cs
+++ b/FluentListView/Rendering/Decorations.cs
@@ -39,6 +39,7 @@
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Rendering/Overlays.cs b/FluentListView/Rendering/Overlays.cs
index a28d740..8cb0252 100644
--- a/FluentListView/Rendering/Overlays.cs
+++ b/FluentListView/Rendering/Overlays.cs
@@ -43,6 +43,7 @@
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Rendering/Renderers.cs b/FluentListView/Rendering/Renderers.cs
index 626a0d0..b9491d6 100644
--- a/FluentListView/Rendering/Renderers.cs
+++ b/FluentListView/Rendering/Renderers.cs
@@ -113,6 +113,7 @@
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using Timer = System.Threading.Timer;
+using Fluent.Lists;
namespace Fluent {
///
diff --git a/FluentListView/Rendering/TreeRenderer.cs b/FluentListView/Rendering/TreeRenderer.cs
index 02a8a8b..f1457f6 100644
--- a/FluentListView/Rendering/TreeRenderer.cs
+++ b/FluentListView/Rendering/TreeRenderer.cs
@@ -17,8 +17,9 @@
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
using System.Drawing.Drawing2D;
+using Fluent.Lists;
-namespace Fluent {
+namespace Fluent.Lists {
public partial class TreeListView {
///
diff --git a/FluentListView/SubControls/GlassPanelForm.cs b/FluentListView/SubControls/GlassPanelForm.cs
index c52eac0..b3d71af 100644
--- a/FluentListView/SubControls/GlassPanelForm.cs
+++ b/FluentListView/SubControls/GlassPanelForm.cs
@@ -46,6 +46,7 @@
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/SubControls/HeaderControl.cs b/FluentListView/SubControls/HeaderControl.cs
index 11c47e1..9269651 100644
--- a/FluentListView/SubControls/HeaderControl.cs
+++ b/FluentListView/SubControls/HeaderControl.cs
@@ -60,6 +60,7 @@
using System.Drawing.Drawing2D;
using Fluent.Properties;
using System.Security.Permissions;
+using Fluent.Lists;
namespace Fluent {
diff --git a/FluentListView/SubControls/ToolTipControl.cs b/FluentListView/SubControls/ToolTipControl.cs
index 820c330..463f77b 100644
--- a/FluentListView/SubControls/ToolTipControl.cs
+++ b/FluentListView/SubControls/ToolTipControl.cs
@@ -42,6 +42,7 @@
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Security.Permissions;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Utilities/ColumnSelectionForm.Designer.cs b/FluentListView/Utilities/ColumnSelectionForm.Designer.cs
index 45d2fee..802c556 100644
--- a/FluentListView/Utilities/ColumnSelectionForm.Designer.cs
+++ b/FluentListView/Utilities/ColumnSelectionForm.Designer.cs
@@ -34,7 +34,7 @@ private void InitializeComponent()
this.label1 = new System.Windows.Forms.Label();
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
- this.objectListView1 = new Fluent.AdvancedListView();
+ this.objectListView1 = new Fluent.Lists.AdvancedListView();
this.olvColumn1 = new Fluent.OLVColumn();
((System.ComponentModel.ISupportInitialize)(this.objectListView1)).BeginInit();
this.SuspendLayout();
@@ -124,7 +124,7 @@ private void InitializeComponent()
this.objectListView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.objectListView1.CellEditActivation = Fluent.AdvancedListView.CellEditActivateMode.SingleClick;
+ this.objectListView1.CellEditActivation = Fluent.Lists.AdvancedListView.CellEditActivateMode.SingleClick;
this.objectListView1.CheckBoxes = true;
this.objectListView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.olvColumn1});
@@ -177,7 +177,7 @@ private void InitializeComponent()
#endregion
- private Fluent.AdvancedListView objectListView1;
+ private Fluent.Lists.AdvancedListView objectListView1;
private System.Windows.Forms.Button buttonMoveUp;
private System.Windows.Forms.Button buttonMoveDown;
private System.Windows.Forms.Button buttonShow;
diff --git a/FluentListView/Utilities/ColumnSelectionForm.cs b/FluentListView/Utilities/ColumnSelectionForm.cs
index cc33e4d..a4dce55 100644
--- a/FluentListView/Utilities/ColumnSelectionForm.cs
+++ b/FluentListView/Utilities/ColumnSelectionForm.cs
@@ -15,6 +15,7 @@
using System.Drawing;
using System.Text;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Utilities/Generator.cs b/FluentListView/Utilities/Generator.cs
index e54e1c0..59b7024 100644
--- a/FluentListView/Utilities/Generator.cs
+++ b/FluentListView/Utilities/Generator.cs
@@ -49,6 +49,7 @@
using System.Reflection.Emit;
using System.Text.RegularExpressions;
using System.Windows.Forms;
+using Fluent.Lists;
namespace Fluent
{
diff --git a/FluentListView/Utilities/OLVExporter.cs b/FluentListView/Utilities/OLVExporter.cs
index da9039f..ac6a810 100644
--- a/FluentListView/Utilities/OLVExporter.cs
+++ b/FluentListView/Utilities/OLVExporter.cs
@@ -30,6 +30,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.Text;
+using Fluent.Lists;
namespace Fluent {
///
diff --git a/FluentListView/Utilities/TypedObjectListView.cs b/FluentListView/Utilities/TypedObjectListView.cs
index a550226..d66dfce 100644
--- a/FluentListView/Utilities/TypedObjectListView.cs
+++ b/FluentListView/Utilities/TypedObjectListView.cs
@@ -40,6 +40,7 @@
using System.Windows.Forms;
using System.Reflection;
using System.Reflection.Emit;
+using Fluent.Lists;
namespace Fluent
{