Silverlight’s DatePicker and Telerik’s RadWindow Dialog

In my current Silverlight project, I’m using the DatePicker control, which is part of the Silverlight SDK. In one scenario, the DatePicker with TwoWay binding is embedded into a User Control, which itself is embedded into another User Control. The format is “dd.MM.yyyy”. Entering e.g. 23.11.2011 works fine, means the …

Refresh A Silverlight Control That Is Using A Converter

One of the great things of Silverlight – from my point of view – is the introduction of converters to format the content if a control, e.g. a text box. Well, the idea itself isn’t new, but it is the first time I saw it built in a Microsoft UI …

Using Styles From Different Class Library In Silverlight

For re-use purposes, it is helpful to put Silverlight styles into a separate class library; let’s call it ResourceLibrary in this example. In the class library which is using the styles from ResourceLibrary, one should declare a Styles.xaml, which only contains a reference to ResourceLibrary: <ResourceDictionary xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”> <ResourceDictionary.MergedDictionaries> <ResourceDictionary …

Why Silverlight Binding’s StringFormat Property Sometimes Isn’t Fully Working

In Silverlight 4, the new Binding property StringFormat was introduced. It’s a nice thing, e.g. if you want to display numeric values with digit grouping and a fix number of decimal places. The syntax is equal to the String.Format: {Binding DataContextProperty StringFormat=’#,##0.00′}. One can, of course, use it for other …

Large Message Size And Bad Request on WCF Service

In an application I built, using Silverlight Client and WCF Service, the application threw an exception when the request data passed by the client to the server exceeded about 64K (might be a little bit less). Using a TCP tracer, I saw that the client received a “bad request” error. …

Accessing Non-Public Member of Abstract Base Classes in Unit Tests

Given you have an abstract base class with non-public member, and a derived class with other non-public member too. Now you want to unit-test some of the non-public member (methods) of the derived class. Prior the call of the method of the derived class, you need to set some non-public …

DatePicker TwoWay-Binding CultureInfo

The sdk:DatePicker seems to have an issue when the value entered need to be bound back to the data container. When showing a value, the current culture info is used. When binding back, always en-US is used. Accordingly, entering the 31st of December fails to bind back, and the 3rd …

XML Data Row Truncation At 2,033 Chars When Using SqlDataReader

When you read Extensible Markup Language (XML) data from Microsoft SQL Server by using the SqlDataReader object, the XML in the first column of the first row is truncated at 2,033 characters. You expect all of the contents of the XML data to be contained in a single row and …

Calculate WeekOfYear from DateTime

using System;using System.Globalization ;namespace ConsoleApplication1{    class Class1    {        [STAThread]        static void Main(string[] args)        {            DateTime dt = DateTime.Now;            System.Globalization.Calendar objCal = CultureInfo.CurrentCulture.Calendar;                int weekofyear = objCal.GetWeekOfYear(dt, CalendarWeekRule.FirstFourDayWeek, DayOfWeek.Monday);                        Console.WriteLine(weekofyear.ToString() ) ;        }    }}