In another blog I covered how to perform filtering using the ListCollectionView class on a datagrid. What I noticed on the implementation on a larger result set was a little lag in the response when characters were being entered into the filter textbox. The way it was implemented was for each character entered; perform a […]
Read More →Tags: C#
TextChanged vs. SelectionChange events in WPF
I made the mistake of using the SelectionChange event on a textbox while implementing some filtering on a DataGrid. What happened, when using SelectionChanged, was that each time the textbox received focus I was executing the filter. Even initially when there was nothing to filter. My logic was checking if the contents of the textbox […]
Read More →Using ODP.Net with NHibernate and System.Decimal
A few months ago I wrote a question asking for solutions to this error. There were some good answers but none of them provided me with a work around that was database independent. At least something that would work with both Oracle and SQL Server. I was implementing some calculated fields in NHibernate and I […]
Read More →NHibernate could not execute query[SQL: SQL not available] in C#
I was writing some new code that would use NHibernate a few days back and while I was testing it I received thie error: Could not execute query[SQL: SQL not available] The value xxx is not of type xxx.xxx.xxx and cannot be used in this generic collection. Parameter name: value de-DE: xxx ist kein Wert […]
Read More →Foreign Key is always 0 (zero) when inserting Parent Child using NHibernate
This one was a toughy. I searched for some time looking for examples about HOW TO: INSERT PARENT / CHILD RELATIONSHIPS using NHIBERNATE. What I found were these really cool looking object oriented AddChild methods, many-to-one and one-to-many mapping relationships. The thing about those examples is that they do not take into account legacy database […]
Read More →Validating time using a masked textbox within a WPF window using C#
This is unfortunately more of a hack than a solution, but I thought I would share it any way. I had the situation where I needed to validate the entered time into a masked textbox. The masked textbox is a Windows Form control, but I hosted it within a WPF window using the WIndowsFormsHost element. […]
Read More →Using LIKE with LINQ to NHibernate in C#
The equivalent to LIKE via the LINQ to NHibernate provider is Contains. An example of a LINQ to NHibernate that will return a result set matching a search like parameter is below. IQueryable<Classname> linqLIKE = (from m in session.Query<Classname>() where m.Code.Contains(“%dex%”) orderby m.CreateDate select m); IList<Classname> ListLIKE = linqLIKE.ToList(); The above […]
Read More →Attempted overcomplicated solution for a complicated system
I was working on a system which had implemented NHibernate, primarily for its ability to support multiple DBMS, such as Oracle and MS SQL Server. The problem came up when trying to insert, specifically in regards to the ID data type. On Oracle the ID data type was NHUMBER, while on MS SQL Server the […]
Read More →How to clear the data from a DataGrid using WPF in C#
I implemented some filtering into one of my DataGrids which required that a reset the initial result set. With a single line of code you can empty out the contents of the DataGrid. datagridResults.ItemsSource = null; Once I reset the contents to empty, I could then add the filtered content back into the DataGrid using […]
Read More →How to hide a DataGrid column in WPF using C#
In a situation where I have a DataGrid which is being bound to a List of a specific class and the DataGrid has AutoGenerateColumns set to true, I found myself needing a way to hide some of the columns which I did not want to present to a user. Below is an example of binding […]
Read More →