Posts

Showing posts from June, 2011

WPF DataBinding Default Value (TargetNullValue)

<TextBlock Text={Binding MyStringProperty, TargetNullValue='' FallbackValue='' /> If the MyStringProperty is null, the binding will throw an exception in absence of the "TargetNullValue". If the databound property is null, the value specified in the TargetNullValue (e.g. "" in this case) will be used

Windows Mobile 6 File IO

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; public class WindowsMobile6IO { /// /// Get the executing assembly's application path in Windows Mobile 6 /// /// internal static string GetApplicationPath() { return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase); } /// /// Get folder path located under your application in Windows Mobile 6 /// e.g. If youe application is at "\\Program Files\\TheRock" /// the "Projects" directory under your application can be accessed at "\\Program Files\\TheRock\\Projects" /// internal static string ProjectsFolderPath { get { return Path.Combine(GetApplicationPath(), "Projects"); } } /// /// Create a directory in Windows Mobile 6 application /// internal static void CreateProjectDirectory() {