Welcome to MSDN Blogs Sign in | Join | Help

Karl Shifflett’s WPF and Silverlight shared design-time code

Here’s a most excellent demonstration of how to author a custom design experience that’s shared between WPF and Silverlight controls. Karl gives you a detailed, step-by-step walkthrough, complete with Task List breadcrumbs:

BreadcrumbTrail

Walkthrough guidance in the form of Task List hints

That’s so clever it blows my mind. Karl shows you precisely how to isolate and package design-time logic that’s specific to WPF and Silverlight, as well as VS and Blend – the table showing which design-time assemblies are loaded in which design tool (VS or Blend) is worth the price of entry by itself. And he shows you the key to code sharing: how to abstract SL- and WPF-specific types through a little type resolver class. It’s all very slick.

Karl’s blog post is here, and the code is here at WPF and Silverlight Designer Extensibility Samples. Have fun with your custom design experiences.

Fishbowl – A Facebook sample app in WPF

uxlabs@Microsoft has just released Fishbowl, a sample client application for Facebook, complete with source code. Fishbowl requires .NET 3.5 and uses WPF and ClickOnce. If you’re using Windows 7, it also demonstrates new features such as Jump Lists, taskbar previews, and multitouch.

You can get more information and install the application from http://www.fishbowlclient.com.

You can get the source code from http://fishbowl.codeplex.com.

Posted by wcsdkteam | 0 Comments

Glenn Block at PDC: Building extensible rich internet applications with the Managed Extensibility Framework

Building Extensible Rich Internet Applications with the Managed Extensibility Framework

In Hall F on Thursday at 11:30 AM

Learn how the Microsoft .NET Framework 4 introduces the Managed Extensibility Framework (MEF) for building customizable applications that can easily be extended by third parties. Whether you are building an extensible data grid, a custom rules engine, a pluggable editor, or a composite application such as a pluggable CRM system, you want to learn about MEF. Hear how to use MEF to decouple your applications into more maintainable and testable pieces, and partition your application into dynamically deployable chunks that download on-demand.

Kids, MEF is the future of extensible apps. Get ahead of the pack and learn about this hot new technology.

Posted by jgalasyn | 2 Comments

WPF samples now available at Code Gallery

In past versions of our Visual Studio and .NET Framework documentation, you may have experienced frustration when you tried to access our WPF sample code.

No more. We’ve picked the best samples, hoisted them out of the docs, updated them for Visual Studio 2010, and uploaded them to Code Gallery: WPF Documentation Samples.

You’ll see example code for creating custom controls, 3D graphics, data binding, and lots of other stuff. Almost all samples have Visual Basic parity with C#. Go install Visual Studio Beta 2 and then check them out.

Brushes Introduction screenshot

Screenshot from the Brushes sample

Posted by jgalasyn | 0 Comments

.NET Framework 4 Beta 2 documentation now available

Docs for .NET Framework 4 Beta 2, Windows Presentation Foundation (WPF), and Visual Studio 2010 Beta 2 are now available at MSDN. You can get information on installing the beta here.

Here are some of the latest updates to the WPF documentation that you might want to check out.

In addition, you might want to check out the new MSDN views - lightweight and scriptfree - that provide better performance while using the documentation.

Silverlight designer sample code is posted

If you’ve been wishing for some helpful designer gestures for your Silverlight DataGrid controls, look no further. The Silverlight Designer Sample is available at the WPF and Silverlight Designer Extensibility site. It demonstrates a pretty neat designer implementation for Silverlight’s TabControl and DataGrid controls.

Silverlight TabControl designer sample

Silverlight TabControl design-time implementation sample

Silverlight DataGrid designer sample

Silverlight DataGrid design-time implementation sample

You’ll need Visual Studio 2010 Beta 1 or higher. Download the code from here: Silverlight Designer Sample and enjoy.

WPF Designer sample code is posted

If you want to author custom design-time experiences for your WPF controls, this is a good place to start.

We have samples for custom adorners, context menus, property value editors, and advanced scenarios. This code is written for Visual Studio 2010 Beta 2, but you should have luck with the Beta 1 bits. A Silverlight example is in preparation but isn’t posted yet.

Check out the code here: WPF and Silverlight Designer Extensibility Samples.

UPDATE: The following list shows the features that are supported by both Visual Studio 2010 and Expression Blend.

  • Adorners
  • Context menus
  • DesignModeValueProvider
  • Default initializers
  • All of the ModelItem features, such as selection manipulation.
  • Property grid extensibility (same as Blend 2)

Property Editors

Custom Dialog Property Value Editor

Dialog property value editor detail

Custom dialog property editor that launches a dialog to set a FileName property

Custom Inline Value Editor

Inline property value editor detail

 

 

Custom inline property value editor

Custom Extended Property Value Editor

Extended property value editor detail

Custom extended property value editor

Adorners

Custom Autosize Adorner

Autosize adorner detail

Custom adorner that sets the Autosize property

Custom Rail Adorner

Opacity slider adorner detail

Custom rail adorner that adjusts the opacity of a control

Custom Inner Rail Adorner

Skew slider adorner detail

Custom rail adorner that adjusts the RenderTransform of a control

In-place Editing

In-place editing detail

Custom adorner that enables in-place text editing

Advanced

Custom Context Menu

Context menu provider detail

Custom context menu that sets the Background of a control

Custom Feature Connector

Feature connector detail

Custom feature connector that displays the pending and activated designer features

Custom Surrogate Policy

Primary selection policy detail

Surrogate policy that enables a custom primary selection policy

Silverlight delivers online viewing experience for Sunday Night Football

The NFL and NBC will be delivering the entire Sunday Night Football season by using Silverlight 3.0 and IIS Smooth Streaming. The first game of the season will be broadcast tonight, with the Tennessee Titans vs. the Pittsburg Steelers. Game starts at 5:00pm PST and you can watch online for free: http://snfextra.nbcsports.com/.

clip_image002

Here are a few of the benefits Silverlight delivers:

  • A full screen video player that is capable of delivering 720p HD video. TV quality on the web.
  • A main HD video feed, plus 4 user-selectable alternate synchronized camera feeds that allows users to switch camera angles themselves. Your TV can’t do that.
  • Adaptive smooth streaming of live HD video, which enables the video player to automatically switch bitrates on the fly depending on networking/CPU conditions. No buffering/stuttering experience.
  • DVR support of the live video, including Pause, Instant Replay, Slow Motion, Skip Forward/Back. You can pause and rewind on live video.
  • Play-by-play data (touchdowns, fumbles, etc) inserted as tooltip chapter markers on the scrubber at the bottom allowing you to quickly seek to key moments. A smarter, contextual DVR.
  • Highlights of major plays created within minutes of the play. NBC is cutting on-demand highlights and publishing them on-the-fly with Smooth Streaming.
  • Sideline interviews with the players. No more channel surfing, you are one click away from additional content.
  • Game statistics. These are live stats coming dir-ctly in real-time from the NFL.
  • Game commentary and Q&A with the SNF hosts. Chat with the live TV broadcasters.

Enjoy! http://snfextra.nbcsports.com/

Technorati Tags: ,
Posted by jgalasyn | 0 Comments

TestApi v0.3 Released!

The third preliminary version of TestApi, the testing API library has been released. TestApi is a library of test and utility APIs that you can use to test WPF, Windows Forms, .Net Framework, and Win32 applications. Check out Ivo's blog post for information on changes and new features in this version.

Get the TestApi here: http://testapi.codeplex.com.

 --Nitya.

Posted by niravi | 0 Comments

Implicit Styles, Templates, Controls and FrameworkElements

    Even though I've been working with WPF for over 3 years, I'm still learning some of its idiosyncrasies. A discussion came up recently about whether implicit styles are applied to elements in a template. It turns out that the answer is, it depends on whether the element inherits from Control.

    Consider the following example. This example creates an implicit style for a Label and another implicit style for a TextBlock. Then it defines a ControlTemplate for a Control, in which is a Label and TextBlock. Finally, the example adds a Control, TextBlock, and Label to the StackPanel. So this XAML displays a TextBlock and Label, which are part of the Control, and another TextBlock and Label, which are not part of the Control.

    <StackPanel>

      <StackPanel.Resources>

        <Style TargetType="Label">
          <Setter Property="Foreground" Value="Red"/>
        </Style>
        <Style TargetType="TextBlock">
          <Setter Property="Foreground" Value="Red"/>
        </Style>

        <Style TargetType="Control">
          <Setter Property="Template">
            <Setter.Value>
              <ControlTemplate>
                <StackPanel Background="Beige">
                  <TextBlock>TextBlock Inside Control</TextBlock>
                  <Label>Label Inside Control</Label>
                </StackPanel>
              </ControlTemplate>
            </Setter.Value>
          </Setter>
        </Style>
      </StackPanel.Resources>

      <Control/>
      <TextBlock Text="TextBlock outside control"/>
      <Label Content="Label outside control"/>

    </StackPanel>

    Here is a rendering of the XAML:

    clip_image001

    Surprised? So was I. Apparently, people have been mystified by this for a while. It turns out that implicit styles are applied to elements in templates if the element inherits from Control, but not if the element doesn’t inherit from Control. Why? The reason I was given is that Controls are more obvious than elements, and it's likely that an implicit style for a control should be applied everywhere, where it is less likely that a implicit style for an element should be universally applied. There's a legitimate point to this argument. Consider the following:

    <StackPanel>
      <StackPanel.Resources>
        <Style TargetType="TextBlock">
          <Setter Property="FontSize" Value="16"/>
          <Setter Property="Foreground" Value="Green"/>
        </Style>

      </StackPanel.Resources>

      <TextBlock HorizontalAlignment="Center" Text="Hello!"/>
      <Button Content="Click me!" Width="200"/>
      <TextBlock HorizontalAlignment="Center" Text="Please click the button"/>
    </StackPanel>

    A Button displays strings by eventually creating a TextBlock and adding the string to the TextBlock. If the TextBlock in the Button used implicit styles defined by the application, the XAML would render this way:

    clip_image002

    That probably isn't the behavior you want. On the other hand, suppose you're creating a cool UI and you want all of your RepeatButtons to have a specific look. If you define the appearance of the RepeatButton once, all RepeatButtons will use have that appearance, even if the RepeatButton is inside a ControlTemplate.

    So if you ever run into seemingly inconsistent behavior and wonder what's going on, now you know. If you've run into this and understood what the difference is and wondered why in the world it was designed this way, hopefully this has given you a little bit of insight.

Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 available for download

The Windows SDK for Windows 7 and the .NET Framework 3.5 SP1 is now available for download.  Click here to download.  For details on what's in the SDK, see the Microsoft Windows SDK Blog.
Posted by mparsons | 0 Comments

Expression Blend 3 released

Including Sketchflow! Check out the Expression Web site and be sure to download the 60 day trial. Stay in touch with the Blend team by visiting the Expression Web blog: http://blogs.msdn.com/xweb/default.aspx?p=3.

New Blend 3 features: http://www.microsoft.com/expression/products/Blend_Features.aspx

Expression Blend 3 Features Streamline Photoshop Import

Expression Blend 3 enables the direct import of Adobe Photoshop files, ensuring a smooth integration with traditional workflows the designer may already have in place. On import, layers can be easily regrouped and elements retain their original formats; layers, layer positions, text and vectors remain available for editing within Expression Blend.

Silverlight 3 and Expression 3 launch today

This morning, Scott Guthrie and Soma announced the launch of Silverlight 3 and the Release Candidate for Expression Blend 3 and SketchFlow. The final version of the Expression 3 family of products will be available within the next 30 days.

Visit the Virtual Launch Platform and check out a 1 hour TV-show style infomercial, customer and partner showcases, learning resources, and more.  The Microsoft.com Silverlight site has also been re-launched with a new homepage, and the MSDN Expression Community Site has been redesigned for Expression 3.

 

LIVE, HD broadcast of the Michael Jackson memorial using IIS Smooth Streaming and Silverlight

Today, July 7th, 10AM PT, 1PM ET – We are broadcasting the Michael Jackson memorial, live in HD from the Staples Center in Los Angeles using IIS Smooth Streaming and Silverlight: http://inmusic.ca/news_and_features/Michael_Jackson.

Technorati Tags:
Posted by jgalasyn | 0 Comments

Chart Controls for WPF ship in the Toolkit

We posted previously about the development of the WPF chart controls.  With the release of the June WPF Toolkit you now have the controls at your fingertips.  You can make bar, pie, bubble, scatter and line graphs.   Check out this blog post for details!

image Here’s the code for the image above:

Add a reference to the System.Windows.Controls.DataVisualization.Toolkit assembly in your project, add the namespace for the Charting controls, add a chart in XAML and add some data in code behind.  Instant pie chart!

XAML

<Window x:Class="WpfChartControl.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"

        xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"

    Title="Window1" Height="300" Width="300">

    <Grid>

        <charting:Chart x:Name="chart" Width="350" Height="250">

            <charting:Chart.Series>

                <charting:PieSeries ItemsSource="{Binding}"

                    DependentValuePath="Value"

                    IndependentValuePath="Key"

                    Title="Pet Preference" IsSelectionEnabled="True" />

            </charting:Chart.Series>

        </charting:Chart>

    </Grid>

</Window>

C#

chart.DataContext = new KeyValuePair<string, int>[] {

                                    new KeyValuePair<string, int>("Dog", 30),

                                    new KeyValuePair<string, int>("Cat", 25),

                                    new KeyValuePair<string, int>("Rat", 5),

                                    new KeyValuePair<string, int>("Hampster", 8),

                                    new KeyValuePair<string, int>("Rabbit", 12) };

VB

chart.DataContext = New KeyValuePair(Of String, Integer)() _

                                {New KeyValuePair(Of String, Integer)("Dog", 30), _

                                 New KeyValuePair(Of String, Integer)("Cat", 25), _

                                 New KeyValuePair(Of String, Integer)("Rat", 5), _

                                 New KeyValuePair(Of String, Integer)("Hampster", 8), _

                                 New KeyValuePair(Of String, Integer)("Rabbit", 12)}

 

More Posts Next page »
 
Page view tracker