What a “feature” 🙁 In one of the LOB apps I’m building, I set some of the text boxes to enabled, read-only and no tab stop. Then I needed top copy the content of one of these text boxes into the clipboard. It was not possible! Because you cannot mark …
Category: .NET
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 …
Continue reading “Using Styles From Different Class Library In Silverlight”
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 …
Continue reading “Why Silverlight Binding’s StringFormat Property Sometimes Isn’t Fully Working”
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. …
Continue reading “Large Message Size And Bad Request on WCF Service”
machine.config Overrides TransactionScope / TransactionOptions.Timeout
You are wondering why your DB-transaction, startet by using(TransactionScope scope = new TransactionScope(timeout)) runs into a timeout after 10 minutes? Because the <machineSettings maxTimeout=”00:10:00″/> in the system.transactions section of the machine.config has a default value of 10 minutes. And whatever is set as timeout of the TransactionScope by code – …
Continue reading “machine.config Overrides TransactionScope / TransactionOptions.Timeout”
Disable Control-Buttons of RadGridView
Using Telerik’s RadGridView, one can connect the add, update, cancel and delete command to RadButtons by setting the Command=”telerik:RadGridViewCommands….” properties of the buttons and link to the grid by setting the CommandTarget=”{Binding ElementName=GridViewName}” property. For some reasons, I needed to disable the buttons, depending on the rights the currently logged …
Snapshot Isolation & Connection Pooling
In case you do open a transaction using isolation level snapshot, make sure you do not disable connection pooling in the connection string (do not set ‘Pooling=false’). Otherwise, opening a connection after you opened and closed another one, you will receive an exception telling the transaction cannot be extended.
Silverlight Unit Test Starting Point
Jeff Wilcox Blog about Unit Testing with Silverlight 2 (http://www.jeff.wilcox.name/2008/03/silverlight2-unit-testing/) Hope its still up-to-date.
Silverlight Resolve Static Resource
Having trouble once again to resolve a static resource in Silverlight code, even though Styles.xaml is located inside the Assets directory? Have a look at app.xaml if Application.Resources contains the following entry: <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source=”Assets/Styles.xaml”/> </ResourceDictionary.MergedDictionaries></ResourceDictionary>
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() ) ; } }}