Falafel’s popular Sitefinity ShadowNav Widget has been updated with a few new features and enhancements.

 

Internationalization Support.

If a user with comes to your site and has a matching language code for a page in your ShadowNav, the menu will display in that language. If all your pages are not translated then there’s a possibility to get mixed languages in the ShadowNav.

 

Here is a sample of how it works and looks.

 

Pages in the system and their translations

image

Note that the default language is English and some pages have been translated into Spanish.

 

This is ...

I have seen an interesting and sometimes annoying side effect of using Silverlight binding on string properties that makes them turn from a null string to an empty (length 0) string. Typically my bindings are bound to WCF RIA Services entities that can have a nullable string. By simply selecting and then unselecting a TextBox that is bound to a nullable string in an entity will cause it to become an empty string.

 

This wasn’t what I wanted to happen. I need strings that have been changed to empty to stay null if and only if the underlying entity ...

There are some instances where the the obstructive Silverlight Toolkit BusyIndicator might not be the right choice for your application. BusyIndicator pops up a control on top of all other controls that shows a message and a graphical animation. I wanted to create a more passive control that doesn’t pop up a control but it still disables all the controls on the page and shows a message on the page.

First I started by creating a User Control. Within this control I added a TextBlock and an Image that I’ll use to set some busy text and an animated image. ...

MVVM (Model-View-View Model) is a programming pattern similar to MVC that you can use to decouple the model and the view from business logic. There are many articles on the internet about what MVVM is so I’m not going to talk about that. In this article I want to concentrate on the most basic MVVM application, understanding it, and how to move on from there.

This example doesn’t have a Model. More than likely when building even the simplest application you will need access to data. If you create an Entity Framework (ADO.NET Entity Data) Model, this would indeed be ...

Recently I had the task of getting an Apache Tomcat installation working on a windows machine as a service. By following the documentation that is available on the internet I tried several techniques including the service.bat and Tomcat6.exe the service. There are tons of options available to install the service and unfortunately almost all of them are necessary. Installing the service over and over to get it running was turning out to be quite time consuming until I found the Tomcat6w.exe. The Tomcat6w.exe is a graphical editing tool for any installed Tomcat service. The fastest way i found to get ...

Recently while implementing forms authentication for a WCF RIA Services application I ran into some trouble setting the expiration of the cookie that kept the user logged in. In the web config I had set the forms timeout to 120 minutes like so:

 1:  <authentication  mode="Forms">
 2:  <forms  name=".App_ASPXAUTH"  timeout="120"  slidingExpiration="true"  />
 3:  </authentication>

This worked just fine. After 120 minutes of the browser being open without Silverlight making a request to the server, the authentication had timed-out and I needed to log in again. Once I had that working correctly ...

When using a ComboBox or ListBox attached to a list of business objects, your list of business objects more than likely does not have an empty value object. If, for example, these business objects are from a database, the table definition might not allow null values. Changing the table to allow null can fix the problem but that might not be the best solution because it might allow invalid data to be put into the table.

A solution to this is to add a blank business object into the list in Silverlight, more specifically with a converter. We can use ...

When creating a domain service on an Entity Framework model typically there is an option to generate the associated metadata classes for adding attributes to the public properties .

It is necessary to have these metadata classes when:

  • Validation attributes such as RangeAttribute, RequiredAttribute
  • Using the IncludeAttribute to send child entities to the client
  • ExcludeAttribute to not send a property to the client
  • Others such as DisplayAttribute, RoundtripOriginalAttribute

One thing to note is that this class is not necessary to use a Domain Service. If you have any of the conditions above that you need to do then the metadata ...

Quite often in my copying and pasting frenzies for Silverlight properties that use notifications I will forget to change the string inside the constructor to PropertyChangedEventArgs(string). The string is the name of the property that needs to send the property changed event. More times than not the calling property getter or setter is indeed the property that needs to be changed so I updated my RaisePropertyChanged method to look at the call stack and find the name.

 

Here’s my NotifyPropertyBase abstract class that I base all my View Models upon:

 1:  public  abstract  class NotifyPropertyBase : INotifyPropertyChanged
 2: {...

I’m sure once you have tried to use DataTemplates in certain controls you will notice that if you give a name to an element you cannot access that element outside the DataTemplate. This makes sense because there will end up being many of these items created in a template and the name you give the element will not be unique. So how would you set an element’s property in the DataTemplate that comes from a FrameworkElement property? It can be done with Dependency Properties.

 

As a side note, the Dependency Properties in this example will work around the issue ...

 

In a recent project I was working on I wanted to create a slideshow or automated dashboard that would show several slides at a given interval. Telerik has a fantastic RadTransitionControl that has some very nice transition effects but doesn’t automatically change the slides. I wanted a generic way of automating this so I went with some attached properties.

 

Here is the declaration of the three attached properties:

 1:  public  static  readonly DependencyProperty IntervalProperty =
 2:     DependencyProperty.RegisterAttached("Interval",  typeof(TimeSpan),  typeof(SelectorSlideShow),  new PropertyMetadata(new TimeSpan(0, 0, 0, 5), IntervalChanged));
 3:   
 4:  public  static  readonly DependencyProperty ...

Using stored procedures is already built into the Entity Framework but using stored procedures with WCF RIA Services then ultimately Silverlight requires some manual work. In this example I am going to step through adding an entity to an ADO.NET Entity Data Model all the way through calling the stored procedure from Silverlight.

 

First setup a Silverlight project of your liking with and make sure to enable WCF RIA Services.

 

Create a new ADO.NET Entity Data Model in the Web project. Connect this data model to the AdventureWorks2008 sample database. At the Choose Your Database Objects page select the Address table ...

 

Recently I was given a task of creating a quick example of someone making a data change to a database table then someone else being able to see the new data. Seemed simple enough. I created a WCF RIA Services application with a simple grid and submit/refresh buttons  on it. I brought up two instances of the application and had one instance change the data and the other refresh it. To my amazement the second instance didn’t see the new data.

I brought up SQL Server Profiler to see what was going on. When hitting the refresh button I ...

In every Silverlight project I have worked on I have needed to set some default styles for use throughout the Silverlight controls. So I create a new Silverlight Resource Dictonary and typically add items such as SolidColorBrush:

<SolidColorBrush x:Key="DefaultForeground" Color="#FF1F4386" />
<SolidColorBrush x:Key="DefaultLabelForeground" Color="GreenYellow" />

 

It is great to have one place to define styles and for the case above colors of my Silverlight components but then I wanted to set a particular font family and font size. This wasn’t immediately clear to me how to do that because ...

  I have written quite a few WCF RIA Services applications now and almost every time I need to pre-fetch some data before showing a Silverlight page or dialog. For instance you might need to get all the years and employees available to so you can put them in ComboBoxes for a dialog. You wouldn’t necessarily want to do this in the Loaded event of the dialog because the dialog will come up with empty information then fill in when the query has returned.

Another problem is that the code turns ugly and hard to manage if you have multiple ...

There have been a few instances when I would like to have an identical copy of an object but want them to be different instances. There are a few brute force ways to do this by either copying the values one by one or by using reflection to iterate over variables, properties, etc. The problem is that these methods are not very generic and need to be tweaked for each situation.

I have discovered that there are a few ways to clone an object by serializing then de-serializing an object into a new deep-copy instance of that object.

Method 1 ...

Recently I was having trouble running sample projects made for Visual Studio 2010 and .NET4. When opening the solution I would get the following warning:

You should only open projects from a trustworthy source. The project file 'project' may have come from a location that isn’t fully trusted. It could represent a security risk by executing customer build steps when opened in Microsoft Visual Studio that could cause damage to your computer or compromise your private information.

I figured that this is a valid warning and continued opening the project. Upon the first build I was getting errors that didn’t ...