Acces to property hidden field

If yyou want to acces easily you can show this post,field%20or%20assign%20to%20it.&text=We%20can%20use%20attributes%20in,properties%20because%20features%20in%20different%20.

use Mono.Reflection as nuget

and use with


see extension for sample


Categories: Non classé Tags:

ToolBoxIcon for wpf Control

Categories: Non classé Tags:

Popup helper for close it on click

If you want to close a Popup automatically when click on it or children, use this helper


see  for ToggleButtonHelper

Categories: Non classé Tags:

ToggleButton to control Popup

When you must control a Popup with ToggleButton you can bind IsOpen of Popup to IsChecked of ToggleButton and set StaysOpen of Popup to false

but in this cas when the Popup is open and you click another time on ToggleButton, the Popup close and reopen immediatly

for having a better result on click on ToggleButton when Popup is open you can use this Helper

and use like this


Categories: Non classé Tags:

ListView Columns Arrange, Sort, Filter, Save with no code behind


Filter sort are not tested with set of big data

For using this, load and see project below (visual studio 2022/ .net 6.0)


For using then you can add to yours <GridView> the two controls

  • local:GridViewColumnEx overrided from GridViewColumn
  • local:GridViewColumnHeaderEx overrided from GridViewColumnHeader

properties for both

Properties Descriptions
CanFilter define column has filter [default = false]
if set to true, filter icon is visible when FilterEditor is correct for datatype
CanSort define column can sorted [default =false]
CanResize define column can resized [default = true]
if set to false, the separator of column is black
CanHide define column can hided [default = false]
if set to true, hide iconis visible
CanMove define column can moved [default = true]
if set to false, DisableMoveColor is applyed
Profil define profil for column (see profils) [default = empty]
FilterEditor Define editor used for filtering (see Editor)
ColumnBindingName Define name of binding of trade object (no necessary to use DisplayMemberBinding)
HorizontalContentAlignment Define position of header in column header (right, center, left) [default = left]
HideToolTip ToolTip text for hide icon [default = « Hide column »]
FilterToolTip ToolTip text for filter icon [default = « Filter column »]
DisableMoveColor Disable move color for header when CanMove = false [default = #10000000]
FilterIndicatorColor Color of filter icon when filter exists [default = Green]
MinColumnWidth Minimum size for header [default = 50d]

properties for local:GridViewColumnEx

Properties Descriptions
Header from GridViewColumn with same usage

propertie for local:GridViewColumnHeaderEx

Properties Descriptions
Content from GridViewColumnHeader with same usage


You can use

  • only GridViewColumnEx
  • GridViewColumnEx with CellTemplate
  • GridViewColumn with GridViewColumnHeaderEx inside
  • GridViewColumn with CellTemplate and GridViewColumnHeaderEx inside

see MainWindowStructure.xaml for sample


the editors are those which make it possible to filter the elements in columns. You can choose for a data type in the column the type of editor you want to have (and behavior)
it set in EditorFilter property (with flag enum) set with ‘,’

Data type Description
Integer See MainWindowInteger.xaml for sample
String See MainWindowString.xaml for sample
Boolean See MainWindowBool.xaml for sample
DateTime See MainWindowDate.xaml for sample
Enum See MainWindowEnum for sample
for enum you can use a TypeConverter for showing value as you want
see in trade.cs enum EStatus and TypeConverter EStatusConverter

You can see sample in MainWindowEditor.xaml for mixing data and editor

You can also define your own editor by redefining the data model for the editor based on Datatype you can find a the end of generic.xaml.
Classes of editor override from BaseFilter (see in FilterClasses.cs)
For sample you can see MainWindowDesign.xaml (in windows resources for redefine)


the profiles are made to quickly define a presentation by hiding the columns which have at least one profil and whose profile is or is not in the selected one.

for sample if you have columns A, B, C, D (profils are set by string separate by ‘,‘)

Column Profil
A (empty or not define)
B alpha,beta
C beta,gamma
D alpha,gamma

If you set profil to

Profil Columns showed
  • A (no profile define)
  • B
  • D
  • A (no profile define)
  • B
  • C
  • A (no profile define)
  • C
  • D

To have a better presentation of the profiles you can add a converter to have personalized viewed texts
for sample i transmform in a converter a,b,c profils text to alpha, beta, gamma texts
with attached property local:ProfilHelper.Converter set in ListView
see ProfilTextConverter.cs 

Like local:ProfilHelper.Converter= »{local:ProfilTextConverter} » see in MainWindowProfil.xaml



You can have 3 context menu on columns by clicking right on GridViewColumnsHeader

  • Normal context menu (right click) for showing colums can hide or show (disabled columns mean are not in selected profil), if one or least has filter show menu item for clear all filter, if current collumn has filter show menu item for clear this filter, and show current profil if exists

  • View profil context menu (right click + shift) view all columns with associated profil (translate by converter if exists)

  • Select profil context menu (right click + ctrl) for selected profil, if a profil is already set you have a menu item for clear this (selected profil is checked and disabled)


Many texts are used for translation in

filter editors

context menus

ColumnsTextHelper is made for this, set in ListView with

Properties Usage Desciption
ClearAllFilterText Context Menu for define text in normal context menu for clear all filter (in picture = effacer tous les filtres) [default = »Clear all filter »]
ClearFilterText Context Menu for define text in normal context menu for clear current filter (in picture = effacer ce filtre) [default = »Clear filter »]
ClearProfilText Context Menu for define text in selected profil context menu (in picure  = Clear selected profil) [default = »Clear selected profil »]
ProfilText Context Menu for define text before in normal context menu when profil is set (in picure = selected profil) [default = »Profil »]
EnumNoneText Filter for define text in filter for All checker (in picture = tous selectionner)  [default = »None view »]
EnumAllText Filter for define text in filter for None checker (in picture = tous deselectionner) [default = »All view »]

see MainWindowProfil.xaml for sample

Static Acess

For better acces you can use static command for

  • ClearSortCommand for clear current sorting

  • ClearAllFilterCommand

see MainWindowProfil.xaml for sample

and you can acess to profils but it’s more complex because you can get the ColumnsManager from ListView

see MainWindowBase.cs for sample (region PROFILS) and see MainWindowProfil.xaml for binding

overall you must have get  ColumnsManger from ListView in Constructor after loading

and after add adapter for Profils and SelectedProfil

for syncronize profil to reality (raise SelectedProfil for wrapper) use

if you want to have a ClearProfil command


The LisView can be save automatically by using local:ColumnsHelper.SaveColumnPositionID= »profil » set in ListView

this mean it save

  • Columns position
  • Columns width
  • if Columns are visible or not (and if you restore visibility you recover previous width)
  • Selected profil

Filter values and sort column are not saved in version 1

You must set different SaveColumnPositionID for each ListView

Save value are set (by default) in .ini file in %APPDATA%\[compagny]\[product].ini however you can set for saving all ListView information in registry at Computer\HKEY_CURRENT_USER\SOFTWARE\[compagny]\[product]\[Id] by using ColumnsHelper.UseIni = false; at the start of the software (before all InitializeComponent() )


If you want to specify Mininum for all columns you can use local:ColumnsHelper.MinColumnsWidth= »60″ set in ListView rather than define in each columns

see MainWindowProfil.xaml for sample

Also you can see another helper define for solve problems on DateTimePicker, Togglebutton or TextBox

See helpers for each for more informations


You can download project

Version 1

(for window template) ColumSave + GridViewColumn v1

Version 2

this version add : ColumSave + GridViewColumn v2

Properties Apply to Desciption
ShowNoSortIndicator GridViewColumnEx or
for showing an indicator (in gray)

only if CanSort = false [default = false]
CanSelectProfil ListView Allow to select profil in select context menu (otherwise show no context) [default = true]
CanShowProfil ListView Allow to show profil in view context menu (otherwise show no context) [default = true]
SelectedProfil ListView to change current profil with value string
see MainWindowProfil.cs for sample

Categories: Non classé Tags:

AutoGrid compoment for input form

Many time we need a input form set in grid
however it’s unpleasant to set for each control in grid the Grid.Row and Grid.Colum when we change one or more definitions (insert or remove children)
the AutoGrid Control is made for simplify this

and you must only set

Property Definition
ColumnsStringDefinition Set columns do you want with (separator |) with Auto, *, double value
UseColumnSeparatorindicate default true
indicate we have a step of one column Between two columns in ColumnsStringDefinition
RowsStringDefinition Default row at auto
otherwize insert for each definition of a row all rows define in this with auto,* and double value

and in xaml
put the children in the order of appearance row then column

Version 2.0 in c# 8

a new version with even and odd color for rows


Categories: Non classé Tags:

Change move indication (Color and width) for ColumnHeader

If you want to change the Moving indicator use this helper

and use like

Categories: Non classé Tags:

Save position and size of ColumnHeader automaticly

I you want to save automaticly position and size of Columnheader for a ListView you can use this AttachedProperty

and use like

the SaveColumnPositionID is the uniq Id of ListView for saving

two possibilities

  • first in ini file (by default)
    // [ID]
    // cols = 3|2|1|0|
    // sizes = NaN|64.4|208.17660377358487|NaN|
  • second in Registry
    // key cols = 3|2|1|0|
    // key sizes = NaN|64.4|208.17660377358487|NaN|

for switch to registry you must insert this code
ListViewHelper.UseIni = false;
before all (in app for sample)
this parameter is Global for all application
and you must have a different SaveColumnPositionID for each ListView

Categories: Non classé Tags:

Ultilmate AutoSelectAll for TextBox and Controls contains TextBox

if you want to  have an SelectAll for TextBox or other controls contains TextBox when frist click inside or got focus

us this code



Categories: Non classé Tags:

ListBox fluid DragDrop with moving list

If you want having a ListBox with moving item and drag (fluid behaviror) and moving list you can use this

two class for attached properties

  • DragDropExtension for moving listbox item on dragdrop
  • ListBoxMoveHelper for specify drag object (in this sample   )

use like this

for result

for information in DragDropExtension

  • Tolerance is the margin (top or bottom) for start moving item in ListBox
  • Offset is the number of item to move


Categories: Non classé Tags: