Tag

Silverlight Archives - Falafel Software Blog

Declarative ComboBoxes in XAML

By | Uncategorized | No Comments

Developing in XAML (Windows 8, Silverlight, Windows Phone, or WPF) gives you a powerful combination of declarative markup with databinding, but one shortcoming I often come up against is the ability to build simple ComboBox elements declaratively with both Content and Values. If you are familiar with HTML, you know that you can use a select tag to pair the display name with a key value, such as: <select>   <option value=”volvo”>Volvo</option>   <option value=”saab”>Saab</option>   <option value=”mercedes”>Mercedes</option>   <option value=”audi”>Audi</option> </select> Notice that the value for each item does not have to exactly match the display name (in the example above, there is no capitalization…

Read More

Loading Google SketchUp 3D Models into Windows Phone Applications

By | .NET, Mobile | No Comments

In some of my previous WP7 blogs, such as Basic XNA Graphics for the WP7, I go over how to build basic 3D models for your applications. What happens when you want something more complex? You need a good 3D tool to generate those models for you. I started exploring Google SketchUp as a possibility for generating 3D models for the WP7. I found Jim’s Blog on how to load a Google SketchUp model into a XNA game. Jim used the DirectX/XNA Exporter Plugin. So I installed the plugin and started playing around. I thought it would be cool to…

Read More

Silverlight Binding on Strings; Fix Blank Strings

By | Uncategorized | No Comments

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…

Read More

Silverlight DateTime Format on Mac

By | Silverlight | No Comments

The Problem I recently discovered that the default Silverlight DateTime format is different on MacOS than it is in Windows.   On Windows   On MacOS   There are a couple of differences, but the most noticeable is that time zone offset at the end of the time that shows on the Mac. On my computer the time zone offset shows as “-4:00” because I’m generating a DateTime in local time, which for me is currently Eastern Daylight Time (EDT), or 4 hours behind Coordinated Universal Time (UTC).   The application is following the best practice of storing all DateTimes…

Read More

Creating a Passive Silverlight Busy Control

By | Uncategorized | No Comments

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….

Read More

Silverlight MVVM Simple and Easy

By | C#, MVVM, Silverlight | No Comments

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…

Read More

Jonathan Tower To Speak At Day Of .NET In Grand Rapids

By | News | No Comments

Day of .NET in Grand Rapids is a one-day conference on all things .NET organized by developers for developers. This event is being offered at a minimal cost to anyone interested in .NET development, and will take place on Saturday October 23rd, at Calvin College REGISTRATION IS OPEN   Jonathan Tower, Falafel Software’s Consulting Engineer will be speaking on Windows 7 Application Development.  Join him there for a sure to be an exciting and productive session!

Read More

Using BindingValidationError to Add Messages to a Validation Summary in Silverlight

By | Silverlight | No Comments

  If you aren’t familiar with it, the ValidationSummary control in Silverlight automatically shows validation exceptions for any controls within its same container element.  That means if you add it to a grid or StackPanel that is full of bound controls, it will capture any validation exceptions from those bindings.  It also gives you all kinds of useful functionality, like taking you to the invalid control when clicking on an item, and even removing the message when the input is corrected. For example, these two textboxes are bound to FirstName and MiddleInitial properties, and MiddleInitial is required to be a…

Read More

Silverlight 3: Using an Attached Property in a Template

By | Uncategorized | No Comments

  Have you ever wanted to use one of your custom attached properties in a control template?  Well I have, but I never could quite get the syntax right, and my bindings always failed.  I had started to think it wasn’t possible!  It was almost as if the template could never quite find the namespace of the attached property once it was applied to the control. But then I saw a piece of Silverlight 3 code  that included another declaration of the namespace inside the element tag, and I thought Oh!  Maybe that will help with those times when the…

Read More

Using CollectionViewSource to Display Ranked Groupings in Silverlight

By | Silverlight | No Comments

I was recently working with a CollectionViewSource in a Silverlight project, but needed to display groupings of the data items as ‘Rankings’, that is: sorted by the number of items in each group.  There are a variety of resources out there on how to sort the items in a CollectionViewSource, and even how to sort the items within a group (this one, for example), but less information on how to sort by how many items are in each group. Let’s take a look at an example CollectionViewSource:  in this case based on a List of DateTime objects representing birthdays.  We…

Read More

Using Telerik’s RadDataForm for Silverlight to Bind to ViewModel Commands

By | Silverlight | No Comments

  I have been using Telerik’s RadDataForm in some Silverlight applications for some time, and have been very happy with the results.  But I only recently discovered another reason to like it – the ability to do some non-collection bindings that are not available in the standard Silverlight toolkit DataForm. If you have used either DataForm, you are probably aware that from inside of your item templates, the DataContext is always relative to the currently displayed item.  So, if I am displaying a collection of ‘TestData’ items: public class TestData { public string Name { get; set; } public string…

Read More

Using CollectionViewSource without Refresh() for Faster Filtering in Silverlight

By | Silverlight | One Comment

CollectionViewSource is quickly becoming one of my go-to tools for complex data viewing and editing in Silverlight.  The Grouping, Filtering, and Sorting operations make what were once difficult features simple and straightforward.  But I sometimes expect too much from CollectionViewSource’s performance with large data sets, and then things get more interesting. I was working with large sets of complex data in a DataGrid, using the CollectionViewSource’s Filter operations to allow the user to ‘Delete’ rows while still keeping the items in the underlying collection to allow either a ‘Cancel’ or a ‘Save’ operation to finalize the change.  Since CollectionViewSource’s Filtering…

Read More

Avoiding Silverlight CollectionViewSource ‘Not Allowed during…Transaction’ Exceptions

By | Silverlight | No Comments

I have written several times about using CollectionViewSource in Silverlight.  It is often highly useful to be able to use a CollectionViewSource and the related CollectionView objects as the ItemsSource for advanced editors like the Silverlight DataForm, DataGrid, or Telerik’s RadGridView controls. But sometimes binding to all of those different editors can get a CollectionView into an open editing or insert state that can be difficult (maybe even impossible) to track down, especially when you need to asynchronously alter properties on the parent CollectionViewSource like filters or grouping.  Enter the dreaded exception: “…not allowed during an AddNew or EditItem transaction”. …

Read More

Silverlight ItemsControls and MVVM: Sometimes, order matters!

By | Silverlight | No Comments

While working on an MVVM project, I was recently debugging an issue with some of my Silverlight ComboBoxes.  The ComboBoxes were bound to pre-set values in the ViewModel, and yet were showing up empty when rendered on the page.  What was really troubling was that some ComboBoxes were working correctly, but others were showing up blank, when they were bound to the same ViewModel and everything looked to be exactly the same! Here’s a sample project where I’ve reproduced the problem: Both ComboBoxes are bound to the same ItemsSource, and both have simple int values as their bound SelectedValue properties. …

Read More

EventBoard featured in Telerik case study

By | News | No Comments

EventBoard is making waves again. Telerik just released a customer case study featuring our mobile conference companion: http://www.telerik.com/company/customers/case-studies/telerik-s-integrated-technologies-help-make-falafel-s-eventboard-solution-a-hit-with-audiences.aspx When Telerik asked if we wanted to be part of a customer case study, the answer was an enthusiastic yes! At every turn, EventBoard utilizes a Telerik solution. The WP7 mobile application uses RadControls for Windows Phone, the administration application uses RadControls for Silverlight, and even the product webpage features blogs powered by Sitefinity. Thanks to the Telerik controls, EventBoard for Windows Phone continues to shine as a model of style and usability. Expanding the use of  Telerik’s  Window’s Phone Controls in future releases…

Read More

New “Mango” book released! Get 50% off through Friday!

By | News | No Comments

Microsoft’s next release of the Windows Phone operating system is here and brings over 500 new features to handsets everywhere. You can learn to build apps that leverage these new features and capitalize on the growing Windows Phone market with our new book, “Windows Phone 7.5 ‘Mango’ Nuts and Bolts”. The best part? It is 50% off through Friday! Get it now with promo code “MangoWeek”: https://www.falafel.com/store/courseware/wp7nutsandbolts.aspx “Windows Phone 7.5 ‘Mango’ Nuts and Bolts” is over 600 pages of step-by-step instructions, detailed explanations, and downloadable source code that will have you cranking out robust, user-friendly apps in no time. Beginners and…

Read More

Meet Falafel Software at Silicon Valley Code Camp

By | News | No Comments

Going to Silicon Valley Code Camp this weekend? Chances are, you will run into a Falafel. Our entire team travels from all over the country to Foothills College this weekend, to attend the biggest (and best) code camp in the country. We love being a part of this fantastic event. This year, Falafel is a platinum sponsor, picked up the tab for Saturday’s pizza lunch, built the mobile track, supplied 7 speakers with 11 informative sessions and donated our mobile application, EventBoard, to be used as the official conference app. Our 7 speakers have been having a friendly competition to…

Read More

Free Webinar: Testing Silverlight Applications

By | News | No Comments

Falafel Software is at it again. Offering you a chance to join one of the industry’s most recognized testing experts in a free webinar. Join our CEO, Lino Tadros, as he teams up with SmartBear Software to bring you, “Tips and Tricks for Performance, Load & Functional Testing Silverlight Apps“ on January 31st, at 1 PM EST. Silverlight applications present their own unique testing challenges, but in this webinar you will learn how to properly use an array of tools from SmartBear Software, including TestComplete, LoadComplete, and AQTime, to verify your Microsoft Silverlight application is rock solid and ready for…

Read More

Falafel CEO Interviewed on Popular Podcast

By | News | No Comments

This week our CEO, Lino Tadros, is the special guest on  the popular .NET development show, “Yet Another Podcast”. The show is hosted by Jesse Liberty, a Senior Developer-Community Evangelist on the Windows Phone Team. Jesse and Lino discuss developing applications for Windows Phone, MVVM, Silverlight, Visual Studio 11 and more. Lino also makes a big promotional offer during the interview, so if you are itching to learn a little bit about Windows Phone, you are going to want to tune in. Grab the podcast here: http://jesseliberty.com/2012/02/06/yet-another-podcast-59lino-tadres/

Read More

Using a Generic Custom Attached Property Part 1

By | Silverlight | 2 Comments

Custom attached properties are a great thing to have and use in a project. If you’re unfamiliar with attached properties or custom attached properties, a good overview can be found here. The basic pattern is easy to implement and is generically the same as shown below. public static readonly DependencyProperty IsBubbleSourceProperty = DependencyProperty.RegisterAttached( “IsBubbleSource”, typeof(Boolean), typeof(AquariumObject), null ); public static void SetIsBubbleSource(UIElement element, Boolean value) { element.SetValue(IsBubbleSourceProperty, value); } public static Boolean GetIsBubbleSource(UIElement element) { return (Boolean)element.GetValue(IsBubbleSourceProperty); } After I implemented more than two custom attached properties I started wondering why not make a generic attached property? So what I…

Read More

Binding Expression Delay with a generic attached property

By | Uncategorized | No Comments

Here’s another permutation of my generic attached property. This time we’re dealing with the problem that occurs when you have a TextBox that’s binded to a filter of some collection. If you do just a straight binding between the TextBox.Text property to the Filter to a CollectionViewSource, then you’ll notice that the binding does not update the filter until you shift focus away from the TextBox. You can get around this by updating the binding in the TextBox.TextChanged event like this.   void TextBox_TextChanged(object sender, TextChangedEventArgs e) { BindingExpression be = textBox.GetBindingExpression(TextBox.TextProperty); if (be != null) { be.UpdateSource(); } }…

Read More

Dynamically Sliding an Image with the Mouse and a Storyboard in Silverlight

By | Uncategorized | No Comments

Adding the ability to dynamically slide an image around with the mouse is not a big deal and can add a cool dynamic to your Silverlight page. You can see an example at the bottom of our Event Board page – http://falafel.com/event_board.aspx. This is just a very wide image with a Storyboard that is updated dynamically with code behind. The trick is to get the left and right scrolling math right to give you a smooth Storyboard animation no matter what you do with the mouse. The XAML is very simple: <UserControl xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation” xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml” xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″ xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″ mc:Ignorable=”d” x:Class=”WinPhoneSlider.MainPage”> <UserControl.Resources> <Storyboard…

Read More

Using a non converter to help you debug binding issues

By | Silverlight | No Comments

Most of the time it’s not a big deal knowing what the binding source is. However when you have to go searching for that source with calls like RelativeSource then you’re not always sure of what you’re getting, if anything. I’ve found using a simple non converter can help a great deal. Let’s say you have a binding in xaml that looks something like this. DataContext=”{Binding RelativeSource={RelativeSource AncestorType={x:Type local:SomeType}}}”   If you’re not getting what you’re expecting in the DataContext, you can use a simple non converter to figure out what you’re getting. public class NonConverter : IValueConverter  {    #region…

Read More

Using a Generic Custom Attached Property Part 2

By | Silverlight | 2 Comments

In part 1 I talked about our strongly typed GenericAttachedProperty<A> class that allows you to quickly attach any object or class to a UI element. This works great as long as you only need to store one int and/or one string and/or one TMyBigClass on the same element. To be able to attach more than one of a particular type to the same UI element we need to update our GenericAttachedProperty<A> class. The problem is that our GenericAttachedProperty<A> class uses the same dependency property name “Value” for all generic types. public class GenericAttachedProperty<T> { public static readonly DependencyProperty ValueProperty =…

Read More