Silverlight

No x:Type, No Problem

November 28th, 2011 / Tech Tock

I had an interesting problem this week.  I needed to use a default template on a subclassed control.  Ordinarily, that would just be:

Style=”{StaticResource {x:Type BaseClass}}”

Of course in Silverlight, there is no x:Type.

The solution I used was to make an attached behavior that takes the class that has the style, finds the style in the resources and applies it.

The problem

Using a TextBox as an example, here’s some default styling that doesn’t get applied to the subclass:

    <UserControl.Resources>
        <StyleTargetType=“TextBox”>
            <SetterProperty=“Foreground”Value=“Red”/>
        </Style>
    </UserControl.Resources>
    <StackPanel>
        <TextBoxText=“Auto Styled”/>
        <local:TextBoxSubclass/>

It ends up looking like this:

Caliburn Micro–Soup to Nuts

August 8th, 2011 / Tech Tock

Just getting into Caliburn Micro for a new Silverlight project.  I was a bit disappointed when I saw that the official cheat sheet was “coming soon”.  Rob Eisenberg made this excellent 9+ part Soup to Nuts tutorial and the Soup to Nuts section of the documentation has content, so the documentation for Caliburn is actually pretty good.  Of course, both these resources suffer from the death of the long form.  Once again I had to convert them to pdf so I could read them on the subway.  Maybe next time I’ll try this utility.

I Presented PowerShell for .NET Developers

June 18th, 2011 / Development in a Blink

At the Hartford Code Camp. It was a full room and while fewer developers have used PowerShell, when I asked what brought them to my talk, the response was they are hearing PowerShell will be fundamental when interacting with Windows going forward.

My demo covers

  • Cmdlets
  • Piping
  • Working with XML
  • Compiling C# on the fly in a script
    • Using the object just created in the same PowerShell
  • Configuring the Debug tab in VS 2010 for launching ISE (Integrated Script Environment)
    • Setting a break point in that C# file, run a script and step through both the C# and PowerShell

PowerShell ShowUI Video Tutorial–Hello World

June 14th, 2011 / Development in a Blink

I put together this short tutorial using ShowUI (download ShowUI HERE). ShowUI is a PowerShell module to help build WPF user interfaces in script. You can use ShowUI to write simple WPF gadgets, quick front ends for your scripts, components, and full applications.

Basic Building Blocks

In the video I demo the basic building blocks you’ll reuse over and over. New-Window, New-StackPanel, New-Label, New-Button and more.

Take a look and let me know what questions you’d liked answered. I’ll include them in the next set of video tutorials.

Share

Blinking UI with a CaretBrush

May 25th, 2011 / Pixel in Gene

A few days back while I was busy designing some UI for a Silverlight app, I accidentally hit upon this fun hack.

image

If you assign a shared Brush resource to the CaretBrush property of the TextBox control, then you start seeing some crazy blinking-light effects at places where the shared Brush is used. It is really fun the first time you see it happening and then on, it is sure to cause some Dilbert style “Mahjobbis Crappus”.

Fortunately the solution is quite simple: DO NOT use a shared brush resource for the CaretBrush !

Demo / Download

Sparklines in WPF and Silverlight

May 8th, 2011 / jimmy.thinking

image

One seemingly-trivial-yet-recurring problem in financial software is the need for a live-updating line-chart. However, from multiple conversations with Lab49 folks, as well as from experience during my first project, I’ve learned that most WPF/Silverlight charting packages suck in various ways, especially if you’re updating their data frequently. Seems like everyone just rolls their own line chart and tailors it to each project, but doesn’t share it for some reason. I’d like to break that trend by sharing and early version of my own sparkline control for WPF and Silverlight.

http://github.com/jschementi/sparkline

Sample Usage:

HTML5 vs Silverlight

April 13th, 2011 / Development in a Blink

Isn’t about which of the two is better, its which one can easily sell to developers, developers, developers

Silverlight has always given up its annual numbers of installation every year it’s been at MIX –[…] From an internal source, numbers have dropped!

This year, no numbers were announced.

Read more of  Scott Barnes’ post. He summarizes:

As a developer you’re in the seat of power & influence, understand your role in this equation as once all become a little more collectively alert as to what’s going on the you in turn can shape what happens next. Corporations like Microsoft, Adobe, Google and Apple are more preoccupied with both Advertising Penetration stats. They would do whatever it takes, to get those numbers high, so play them, do not let them play you.

Microsoft restates their emphasis on Silverlight

April 4th, 2011 / Development in a Blink

Two significant industry dynamics have taken shape since [Silverlight was introduced] that cause us to emphasize the role of Silverlight differently as a key tool in the developer toolbox.

MIX 11 kicks off next Tuesday, April 12 and the Silverlight Team posted this announcement on Standards-based web, plug-ins, and Silverlight.

Here are some interesting snippets:

  • [Microsoft] has shown an unprecedented commitment to being leaders in HTML5 browsers
  • [Microsoft] has probably not emphasized enough the tooling for HTML5. We’re going to emphasize that much more going forward [...]
  • Over the coming months we’ll be particularly demonstrative of our emphasis on HTML5

Analyze Microsoft MIX11 Session Data With PowerShell

March 28th, 2011 / Development in a Blink

Microsoft MIX11 Conference information is up. So is their OData feed. I wanted to see frequency count of the top 10 tags for the sessions posted. So I used PowerShell (see the script at the end of the post) to connect to the OData feed to pull the titles, the tags and create a denormalized dataset to analyze.

Looks like HTML5 eek out the number of Silverlight sessions, followed closely by Azure.

Is Microsoft hedging their bet?

March 1st, 2011 / Development in a Blink

This week is the MVP (Most Valuable Professional) Summit at Microsoft. Everyone is under NDA. On twitter #mvp11, there are mild hints about lots of V.Next technology.

In the midst of all this:

Microsoft launches contest to encourage HTML5 content creation without browser plug-ins

We believe that HTML5 and related technologies, in conjunction with faster and faster browsers, finally give developers the tools they need to create experiences that are just as vivid, interactive and high-fidelity as what you have come to expect from native applications without the need for plug-ins. We want to see what you can do unplugged…

Transposed Silverlight DataGrid

November 30th, 2010

This seems to be a frequent requirement in the financial domain and possibly others.

Current SL DataGrid does not support this feature, but it is possible to implement it quite easily.

When I faced that requirement on a client project I considered two approaches:
1. Transpose the data set
2. Try to style the grid (rotate the grid and counter rotate the cells)

The second approach seemed scary and uncertain (rendering performance, UI gremlins) and I chose to transpose the data. This did work but column features like sorting, reordering, etc were not supported.

Adobe Max Post-Conference Thoughts

November 4th, 2010 / Thinking in Code » lab49

If I were to describe Adobe Max 2010 in one word, it would be this: hopeful.  The conference itself was a smash.  Adobe really know how to put on a show and please their community.  They know what we want and like because in a way, they are us.  But the conference isn’t what I was hopeful about, it’s the technology.  In these turbulent times of RIA development which really picked up over the years with Microsoft’s solution, Silverlight, and the recent push for HTML5, no one really knows who’s going to emerge victorious.

Microsoft: Silverlight Is (almost) Dead

October 31st, 2010 / Andre de Cavaignac : On Software

Following up on my previous post: Ballmer: Microsoft's Strategic RIA Platform is HTML5, it appears that Microsoft is officially switching its strategy away from silverlight and to HTML5.

Highlighted in two articles, from the company and PDC itself:

“Silverlight is our development platform for Windows Phone,” he said. Silverlight also has some “sweet spots” in media and line-of-business applications, he said. But when it comes to touting Silverlight as Microsoft’s vehicle for delivering a cross-platform runtime, “our strategy has shifted,” Muglia told me. Silverlight will continue to be a cross-platform solution, working on a variety of operating system/browser platforms, going forward, he said. “But HTML is the only true cross platform solution for everything, including (Apple’s) iOS platform,” Muglia said.

HTML is the only true cross platform solution for everything

October 30th, 2010 / Development in a Blink

Microsoft abandons Silverlight in favour of HTML5.

“Silverlight is our development platform for Windows Phone”

Bob Muglia, Microsoft President.

I went to The Penn Club to attend the ThoughtWorks Technology Radar presentation, HERE is the radar write up.

On Hold

  • RIA – Rich Internet Applications. Yes, Silverlight and Flash. Microsoft’s IE9 is poised to be the fasted JavaScript and HTML5 engine on the planet. Not a good sign for Silverlight.

Ballmer: Microsoft’s Strategic RIA Platform is HTML5

October 26th, 2010 / Andre de Cavaignac : On Software

While browsing around the web the other day, I came across what appeared to be the most popular tech story of the day: here in Engaget:Ballmer: next release of Windows will be Microsoft's 'riskiest product bet' .

 So I went to watch the video, and found what no one seems to be talking about, the real gem of this Ballmer interview:

Interviewer: "HTML or Silverlight, what is Microsoft's lead strategy for developing rich internet applications? Silverlight, HTML5, or acquiring Adobe?"

WPF in 60 Seconds

August 11th, 2010 / Tech Tock

Or:  So Much WPF, So Little Time

I’ll be presenting on WPF at the September 21st .Net Meetup.

A breezy tour of topics in WPF from the ground up with demo examples and source code.  Each topic will be given a one minute treatment.  For anyone interested in, new to, or learning WPF you can see the scope of the platform and see what you want to learn.  For anyone working in WPF, enjoy the highlights of your platform.  You might even see something you’ve missed.

Everything will apply equally to Silverlight, subject of course to this diagram.

6 Generic OData (Open Data Protocol) applications

August 7th, 2010 / Development in a Blink

Cider – A Bitter Brew

July 22nd, 2010 / Tech Tock

Cider is the name for that incredibly slow and useless XAML preview in Visual Studio 2008.  Instructions on how to turn it off can be found here.

MVVM + A Little C == MVPoo?

July 6th, 2010 / Development in a Blink

The MVPoo (or M-V-poo to be more precise as defined by its creator, Dr. WPF) pattern recognizes the fact that there is a difference between the ideal world and the real world so that nice and clean implementation of the MVVM(C) pattern is not always achievable

MVPoo

via Microsoft UK Application Development Consulting

PowerShell Hacker #1

May 15th, 2010 / Development in a Blink

Why PowerShell Hacker? Why Not?

I like Jeffrey Snover’s tweet – Become a first follower and join the dance! http://www.youtube.com/watch?v=fW8amMCVAJQ&sns=em