Archives
-
C# Code Snippets for properties raising PropertyChanged event
I decided to publish the snippets I use to implement properties that raise the PropertyChanged event. There are two code snippets, one generates a property raising the event, it is called by typing propnpc in the code editor, and generates the following code:
-
MOQ 3.5 Beta released
MOQ 3.5 Beta was released, it includes a lot of fixes of the previous version. You can get the binaries here. If you are using Visual Studio 2010 you should download the version called: Moq 3.5 Beta Binaries and Help (with Castle Assemblies).
-
How to get notifications in attached properties
Sometime we need to know when an attached property change its value for a specific FrameworkElement. For example consider the following:
-
How to force a binding to update
It is really very simple, all that we need is the FrameworkElement and the DependencyProperty that we need refresh. I did some extensions method to update the target or the source of the binding:
-
Publish a Clickonce deploy with assemblies not referenced in Visual Studio 2008 SP1
Some time ago I wrote a post about this subject, but that post only apply to Visual Studio 2005. The targets used in that post where changed. Basically this post is an update to Visual Studio 2008 SP1. Note that this post does not apply to Visual Studio 2008 without SP1, there were some changes between the two versions of the used target.
-
How to disable Copy and Paste for a control in WPF
By default all the TextBox’s (an other controls) in WPF have a default ContextMenu that allows copy, paste and cut. You can disable this menu by setting this property as “{x:Null}”, but the keys associated with the menu options still work. In order to disable this commands we can use the DataObject class, which have handlers to attach any DepencencyObject in case on Copy or Paste:
-
WPF Validation with Attributes and IDataErrorInfo interface in MVVM
WPF provides validation infrastructure for binding scenarios through IDataErrorInfo interface. Basically you have to implement the Item[columnName] property putting the validation logic for each property in your Model (or ModelView) requiring validation. From XAML you need to set ValidatesOnDataErrors to true and decide when you want the binding invoke the validation logic (through UpdateSourceTrigger).
-
MOQ 3.1 released
Finally MOQ 3.1 was released, it includes a lot of fixes of the previous version (3.0). You can get the binaries here.
-
Using expression trees to get property getter and setters
There are times when you need get and set property values and you do not know the type of the properties. One option is use reflection through GetValue and SetValue from PropertyInfo class, but this wears to poor performance in our code.
-
Moq 3.0 Final
Finally the new version of Moq is released, check the new improvements and fixes here.
-
Sticky notes add-in for Visual Studio
My coworker Pablo has released a nice Visual Studio add-in called Sticky Notes. Basically this add-in allows to write sticky notes in your code, that can be private notes or team notes.
-
Easy way to compare two XMLs for equality
The first thing to do is normalize to two XMLs, for this you can use a small method using Linq: