Mike Taulty's Blog
Bits and Bytes from Microsoft UK

November 2009 - Mike Taulty's Blog

Blogs

Mike Taulty's Blog

Elsewhere

  • Windows System Colour Theme for Silverlight

    This is something that I played with on a basic level a while ago but Corrina has just put together a post with a new downloadable theme around high-contrast themes for Silverlight – here’s the link; Windows System Colour Themes for Silverlight
    Filed under: ,
  • Blog Code Formatting Test

    Quick test post – I’ve spotted a problem with blog code formatting for examples such as; static void Main() {     int[] array = new int[10];     int i = 5;     int value = array[i]; } which my code formatter appears to put out as; static void Main() { int[] array = new int[10]; int i = 5; int value = array[i]; } and an emoticon appears to pop up instead of array[i] – ho hum, looks like it’s time to go around the loop again on “how to get code formatting to work on the website”. It looks fine in Live Writer but not when published. Update – this looks to be Community Server’s “emoticon filter”, attempting to change…
    Filed under:
  • Debugging Silverlight Out-Of-Browser Applications

    I was watching Joe Stegman’s talk at PDC09 about “ Improving and Extending the Silverlight 4 Sandbox ” and I learnt something that I felt I really should have known already and had a bit of a “D’oh!” moment but I’m not too proud to share my ignorance. You probably know this already but… If you’re working with a Silverlight out-of-browser application project in VS ( 2008 Sp1 or 2010 ) – i.e. if you’ve done at least the following steps; then your application will spring up and you’ll hit your breakpoint. However, if you now take that application out-of-browser; then you’re breakpoint won’t hit because VS thinks you want to debug Silverlight code in the browser and doesn’t realise that you want to debug Silverlight code inside of SLLauncher.exe which provides the hosting for out-of-browser Silverlight apps. Now, up until seeing Joe’s talk I’ve been getting around this by manually changing my settings to cause the debugger to launch SLLauncher with the right parameters for my SLOOB and asking to debug Silverlight...
    Filed under: ,
  • Silverlight 4 Rough Notes: Managed Extensibility Framework

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts.   The Managed Extensibility Framework (MEF) has been getting a lot of interest lately and it’s something that’s out on CodePlex and it’s also part of .NET Framework 4.0. It’s also part of Silverlight 4. The name’s a good one – it’s a framework for building an application that is made up of a bunch of loosely coupled components with a lot of flexibility around component discovery, registration, lookup and lifetime management. If I had to sum it up in my own words I’d say something like; MEF composes an application by extensibly discovering a set of components which offer exported functionality and ( possibly ) rely on imported functionality. The link between the two is a simple string name ( a MEF “contract...
    Filed under: ,
  • Silverlight 4 Rough Notes: Viewbox

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. Viewbox is pretty well understood – it’s been around in WPF since version 1 and it’s also part of the Silverlight Toolkit. In the current Silverlight 4 preview it’s also back in the platform. The essential idea of the Viewbox is to scale its child content to fill the space that the Viewbox itself is occupying. I’ve always found this useful for situations where I’ve got content that I’ve organised at a fixed size and I simply want to scale that up/down rather than trying to do some dynamic layout with the content. If I’ve got a simple UI such as; <UserControl x:Class="SilverlightApplication11.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http...
    Filed under: ,
  • Silverlight 4 Rough Notes: CompositeTransform

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. A short one – Silverlight 4 has a new CompositeTransform class that you can use for your RenderTransform values – it looks like; and the transformations run scale->skew->rotate->translate – really this just saves you having to use separate ScaleTransform, SkewTransform, RotateTransform and TranslateTransform so saves on the length of XAML.
    Filed under: ,
  • Silverlight 4 Rough Notes: TextBlock with Trimming

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. A simple new feature in Silverlight 4 – if you have a TextBlock where the text overflows the space available then you can set the TextTrimming property; <TextBlock Text="The quick brown fox jumps over the lazy dog" TextTrimming="WordEllipsis" /> with the effect that as I resize the browser window ( in this case ); it displays the familiar “…” to indicate that there’s more text that is revealed if I give the text more space.
    Filed under: ,
  • Silverlight 4 Rough Notes: Mousewheel Support in Controls

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. Silverlight 3 added support for the MouseWheel event and it is present on the UIElement class. However, the controls in Silverlight don’t generally respond well to mouse wheel events whereas in Silverlight 4 you should expect to see controls doing the right thing in response to the mousewheel. As an example, here’s a quick ListBox; <UserControl x:Class="SilverlightApplication30.MainPage" 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"...
    Filed under: ,
  • Silverlight 4 Rough Notes: SelectedValue

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. In Silverlight today Selector controls like the ComboBox and ListBox are lacking a couple of crucial properties from the WPF world – the SelectedValue and SelectedValuePath properties. This is a little painful – you can see examples of people working around it here and I’ve hacked around with that approach myself in the past. So, it’s great to see these show up in Silverlight 4. As a quick illustration, imagine I’ve got this Person class; public class Person { public string FirstName { get; set; } public string LastName { get; set; } public int CountryId { get; set; } } and that CountryId is really a foreign key into a lookup table of countries represented for me here by these classes; public class Country ...
    Filed under: ,
  • Silverlight 4 Rough Notes: Taking Control of Navigation

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. Silverlight 3 introduced a new navigation style of application where a Silverlight application is structured out of a set of Pages which are displayed by a Frame that navigates to those pages ( by changing its Uri Source property to point at a specific page ). This is underpinned by a NavigationService which supports the idea of navigating forward/backwards and the functionality also integrates with the browser’s history and address bar. As pages are navigated to there’s a nice overload where they can run code and ( e.g. ) interrogate the query string to grab parameters from it. It means that a Silverlight application can behave exactly like the rest of the web with forward/backward navigation and can offer...
    Filed under: ,
  • Silverlight 4 Rough Notes: Data Grid Enhancements

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. A lot of data is presented in grids and that’s especially true in business applications and so the presence of the DataGrid control in Silverlight is really important. In Silverlight 4, the DataGrid gets a few enhancements – mostly easy to understand but important to have. Sizing of DataGrid Columns When you’re working with a Silverlight 4 DataGrid, you’ll find new options for the Width of a column as the editor shows below; So we can use settings like “ *” settings in order to size header columns and if I’ve got a definition such as; <data:DataGrid AutoGenerateColumns="False"> <data:DataGrid.Columns> <data:DataGridTextColumn Header="One" Width="Auto" /> <data...
    Filed under: ,
  • Silverlight 4 Rough Notes: HTML interop & dynamic language features

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. With Silverlight 4 comes C# 4 and VB 10 and some of the new capabilities around being able to do dynamic dispatch. As in the full .NET framework that means that you can use new ways to invoke methods/properties/events at runtime via dynamic dispatch into objects either via; reflection COM interop some custom mechanism – i.e. the dynamic support is pluggable There’s a custom implementation in Silverlight 4 around dynamic invocation into the HTML DOM’s types. Since version 2, Silverlight has had a very strong story around integration with the HTML DOM and you can do all kinds of interoperability between the Silverlight world and the HTML world including manipulating the UI’s of the 2 worlds from their 2 programming...
    Filed under: ,
  • Silverlight 4 Rough Notes: Animating Items Into/Out Of ItemsControls

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. If you’re very sharp-eyed you might spot that the default ControlTemplate for a ListBoxItem has changed to include a new VSM state group called LayoutStates and that group includes states called BeforeLoaded, Loaded and Unloaded . These allow you to apply transitions to items as they are added and removed from a ListBox ( or, perhaps more generally an ItemsControl but I haven’t quite figured that out at the time of writing ). So, for instance – if I take the standard ListBoxItem template from Silverlight 3 ; <Style TargetType="ListBoxItem"> <Setter Property="Padding" Value="3" /> <Setter Property="HorizontalContentAlignment" Value="Left" />...
    Filed under: ,
  • Silverlight 4 Rough Notes: Customising the Window

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. For an out-of-browser Silverlight 4 application, you can take more control around the Window that presents your application. Firstly, by changing the XML manifest you can control where the Window positions itself on the screen, for example; <OutOfBrowserSettings ShortName="SilverlightApplication24 Application" EnableGPUAcceleration="False" ShowInstallMenuItem="True"> <OutOfBrowserSettings.Blurb>SilverlightApplication24 Application on your desktop; at home, at work or on the go.</OutOfBrowserSettings.Blurb> <OutOfBrowserSettings.WindowSettings> <WindowSettings Title="SilverlightApplication24 Application" WindowStartupLocation="Manual"...
    Filed under: ,
  • Silverlight 4 Rough Notes: Commanding

    Note – these posts are put together after a short time with Silverlight 4 as a way of providing pointers to some of the new features that Silverlight 4 has to offer. I’m posting these from the PDC as Silverlight 4 is announced for the first time so please bear that in mind when working through these posts. WPF has tended to have more features than Silverlight around Commanding . The basic idea of commanding is just that a piece of UI fires some logical command rather than invoking some event handler directly. That’s nice as it means that you can easily have multiple pieces of UI firing the same command and it also lets you take the handling of the command away from the piece of UI that invokved it. A quick example; The user interface displays a button “Save” and a menu option “File->Save”. These both need to be disabled when the document state is not dirty and they both need to be handled by a common routine on the Document class called Save . Commanding makes that possible. In WPF you can do this kind of thing...
    Filed under: ,
1 2 3 Next >