in

WPF Design and Development

IdentityMine Team Blogs

Sajiv Thomas

WPF DataBinding, 3D, Graphics, Controls, Silverlight

November 2007 - Posts

  • Silverlight 1.0 Carousel

    I tried creating a stripped down version of a Carousel control (in Silverlight 1.0) which displays images. As of now it just rotates in the clockwise direction on ‘MoueEnter’. I will try to add more features to it as I move on to Silverlight 1.1. You can see it runing here. Here is the Source. 
      
    Posted Nov 07 2007, 03:33 AM by Sajiv with 1 comment(s)
    Filed under:
  • How to change the Source property of a Frame control in WPF?

     

    Suppose we have a Frame control in our application and it inherits it’s ‘DataContext’ from its parent Window. If we need to change the ‘Source’ property when a certain condition is true then we could style the Frame as seen below:
    <Style x:Key="FrameStyle" TargetType ="{x:Type Frame}">

    <Setter Property="Source" Value="{Binding XPath=@Path}"/>

    <Style.Triggers>

    <DataTrigger Binding="{Binding XPath=@IsRedirectionRequired}" Value="Yes">

    <Setter Property="Source" Value="{Binding XPath=@AlternatePath}" />

    </DataTrigger>

    </Style.Triggers>

    </Style>

     We are assuming that our DataSource is an XML file which contains the path to various loose XAML files and an alternate path for each. Something like this.
    <Files>

    <File Name="File1" Path="http://www.identitymine.com" AlternatePath="http://www.blendables.com/" IsRedirectionRequired="Yes"/>

    <File Name="File2" Path="http://www.google.com" AlternatePath="http://www.msn.com" IsRedirectionRequired="No"/>

    </Files>

     Here is a sample. 

     

     #Note: Setting the ‘Source’ or ‘Content’ property on the Frame locally (either using DataBinding or hard coded values) as seen below will result in the style having no effect.
    <Frame Source="{Binding XPath=@Path}" Grid.Column="1" Width="Auto" Height="Auto" Style="{StaticResource FrameStyle}" />
     
    Posted Nov 07 2007, 12:59 AM by Sajiv with no comments
    Filed under:
More Posts
© 2007 IdentityMine, Inc.
Powered by Community Server (Commercial Edition), by Telligent Systems