WPF XAML Visibility binding with property value comparison

WPF XAML Visibility binding with property value comparison

Following on from my previous articles about 'Passing multiple parameters to an ICommand in WPF' and 'Speeding up large WPF ComboBoxes' the application stack I am currently working on has provided another article on a WPF subject!The ability to show or hide UI elements based on criteria related to other elements is nothing new; only showing an 'Other Details' text box when a drop-down value of 'Other' is selected is the bread and butter of many end-user applications. There are a number of ways of doing this in the WPF/XAML/MVVM world, the default is often the use…

Read More

Speeding up large WPF ComboBoxes

Speeding up large WPF ComboBoxes

The WPF application I am working on at the moment contains a questionnaire definition system; the user interface for which contains a number of ComboBoxes (drop-down lists). The nature of the application means that some of these ComboBoxes contain a large number of dynamic entries (not hardcoded, they change based on user actions).I have found that WPF ComboBoxes with a large number of entries; particularly ones which have overridden ToString methods, can take a second or two to 'drop down' (display). This is because WPF renders the entire dropdown interface when it opens; this means if you have many…

Read More

Passing multiple parameters to an ICommand in WPF

Passing multiple parameters to an ICommand in WPF

The project I am currently working on is a sizable line-of-business desktop program written using the WPF framework; a framework I particularly like working with due to its extensibility and ease of design (via XAML).One of the powerful parts of WPF is the ICommand system for binding buttons to ViewModel methods; I won't go into the details of it here as it deserves an article of its own. However one of its basic functions is the ability to pass a parameter from the UI back to the ViewModel's ICommand property, such as the selected item in a data table.…

Read More

Passing Enumerables to a SQL Stored Procedure

Passing Enumerables to a SQL Stored Procedure

I have been asked the question "Can you pass an enumerable to a procedure?" or "How do you pass a table to a stored procedure" several times in the past. The simple answer is "yes", the slightly more complex answer is "yes, and this is how"!How to pass an Enumerable to a SQL Stored Procedure in .NETAlthough my example code here is in C# the same process applies to other .NET languages.You can indeed pass an enumerable object to your Stored Procedure by using a special type of SQL object called a "User Defined Table Type". UDTTs can…

Read More

Do you fizz buzz, buzz fizz, or just scratch your head?

Do you fizz buzz, buzz fizz, or just scratch your head?

Over the years I have interviewed a lot of developer candidates and given advice to a fair few potential developers who are looking for their first interviews. Again and again, the FizzBuzz test has cropped up, and I have seen both some fantastic and some not so fantastic answers to the problem. For those who are not aware of what the FizzBuzz test is, here is the standard question:Write a function which prints all the numbers from 1 to 100. But when printing a number which is a multiple of three print the word "Fizz" instead of the number,…

Read More