<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>WPF em Português - by Miguel Duarte</title>
	<atom:link href="http://wpfpt.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpfpt.wordpress.com</link>
	<description>Windows Presentation Foundation e muito mais</description>
	<lastBuildDate>Fri, 13 Mar 2009 12:17:34 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>pt</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='wpfpt.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/9448df07d8e27f016321415c09409a2c?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>WPF em Português - by Miguel Duarte</title>
		<link>http://wpfpt.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://wpfpt.wordpress.com/osd.xml" title="WPF em Português &#8211; by Miguel Duarte" />
		<item>
		<title>InertiaScrollViewer &#8211; ScrollViewer com inercia! (UPDATED)</title>
		<link>http://wpfpt.wordpress.com/2009/03/13/inertiascrollviewer-scrollviewer-com-inercia-updated/</link>
		<comments>http://wpfpt.wordpress.com/2009/03/13/inertiascrollviewer-scrollviewer-com-inercia-updated/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 12:11:57 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/?p=28</guid>
		<description><![CDATA[Aqui fica o novo codigo do InertiaScrollViewer, tem algumas melhorias principalmente em termos de performance.

    public class InertiaScrollViewer : ScrollViewer
    {
        DispatcherTimer _yourTimer;

        public InertiaScrollViewer()
        {

   [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=28&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Aqui fica o novo codigo do InertiaScrollViewer, tem algumas melhorias principalmente em termos de performance.</p>
<pre class="brush: csharp;">
    public class InertiaScrollViewer : ScrollViewer
    {
        DispatcherTimer _yourTimer;

        public InertiaScrollViewer()
        {

            _yourTimer = new DispatcherTimer(DispatcherPriority.Normal);
            _yourTimer.Interval = TimeSpan.FromMilliseconds(10);
            _yourTimer.Tick += new EventHandler(yourTimer_Tick);

            this.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            this.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
        }

        #region Overrides

        protected override void OnPreviewMouseDown(System.Windows.Input.MouseButtonEventArgs e)
        {

            Point mouseposition = e.GetPosition(this);
            InertiaScrollViewer.SetIsDragging(this, true);
            InertiaScrollViewer.SetTargetX(this, mouseposition.X * -1);
            InertiaScrollViewer.SetTargetY(this, mouseposition.Y * -1);
            double offsetx = this.HorizontalOffset + mouseposition.X;
            double offsety = this.VerticalOffset + mouseposition.Y;
            InertiaScrollViewer.SetOffset(this, new Point(offsetx, offsety));
            _yourTimer.Start();
            base.OnMouseDown(e);
        }

        protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e)
        {
            Point mouseposition = e.GetPosition(this);
            InertiaScrollViewer.SetTargetX(this, (mouseposition.X) * -1);
            InertiaScrollViewer.SetTargetY(this, (mouseposition.Y) * -1);
            InertiaScrollViewer.SetIsDragging(this, false);
            base.OnMouseUp(e);
        }

        protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
        {
            InertiaScrollViewer.SetIsDragging(this, false);
            base.OnMouseLeave(e);
        }

        protected override void OnPreviewMouseMove(System.Windows.Input.MouseEventArgs e)
        {
            if (!CanDrag &amp;&amp; (InertiaScrollViewer.GetIsDragging(this) == true))
            {
                Point mouseposition = e.GetPosition(this);
                InertiaScrollViewer.SetTargetX(this, (mouseposition.X) * -1);
                InertiaScrollViewer.SetTargetY(this, (mouseposition.Y) * -1);
                _yourTimer.Start();
            }
            base.OnMouseMove(e);
        }

        #endregion

        private void yourTimer_Tick(object sender, EventArgs e)
        {

            if (!CanDrag)
            {
                this.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
                this.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                if (InertiaScrollViewer.GetIsDragging(this))
                {
                    double oldX = this.HorizontalOffset;
                    double oldY = this.VerticalOffset;

                    this.ScrollToVerticalOffset(this.VerticalOffset + (((InertiaScrollViewer.GetTargetY(this) + InertiaScrollViewer.GetOffset(this).Y) - this.VerticalOffset) * .3));
                    this.ScrollToHorizontalOffset(this.HorizontalOffset + ((InertiaScrollViewer.GetTargetX(this) + InertiaScrollViewer.GetOffset(this).X) - this.HorizontalOffset) * .3);

                    InertiaScrollViewer.SetVelocityX(this, (this.HorizontalOffset + ((InertiaScrollViewer.GetTargetX(this) + InertiaScrollViewer.GetOffset(this).X) - this.HorizontalOffset) * .3) - oldX);
                    InertiaScrollViewer.SetVelocityY(this, (this.VerticalOffset + (((InertiaScrollViewer.GetTargetY(this) + InertiaScrollViewer.GetOffset(this).Y) - this.VerticalOffset) * .3)) - oldY);
                }
                else
                {
                        this.ScrollToHorizontalOffset(this.HorizontalOffset + InertiaScrollViewer.GetVelocityX(this));
                        this.ScrollToVerticalOffset(this.VerticalOffset + InertiaScrollViewer.GetVelocityY(this));

                        InertiaScrollViewer.SetVelocityX(this, InertiaScrollViewer.GetVelocityX(this) * VelocityConst);
                        InertiaScrollViewer.SetVelocityY(this, InertiaScrollViewer.GetVelocityY(this) * VelocityConst);
                }

            }
            if ((Math.Abs(Math.Round(InertiaScrollViewer.GetVelocityX(this), 1)) == 0.0
                &amp;&amp; Math.Abs(Math.Round(InertiaScrollViewer.GetVelocityY(this), 1)) == 0.0)
                || (this.ScrollableHeight==this.VerticalOffset &amp;&amp; this.ScrollableWidth==this.HorizontalOffset)
                || (0 == this.VerticalOffset &amp;&amp; 0 == this.HorizontalOffset))
            {
                _yourTimer.Stop();
                this.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
                this.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            }
        }

        #region Properties
        #region TargetX
        public static double GetTargetX(DependencyObject obj)
        {
            return (double)obj.GetValue(TargetXProperty);
        }

        public static void SetTargetX(DependencyObject obj, double value)
        {
            obj.SetValue(TargetXProperty, value);
        }

        // Using a DependencyProperty as the backing store for TargetX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetXProperty =
            DependencyProperty.Register(&quot;TargetX&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        #endregion

        #region TargetY
        public static double GetTargetY(DependencyObject obj)
        {
            return (double)obj.GetValue(TargetYProperty);
        }

        public static void SetTargetY(DependencyObject obj, double value)
        {
            obj.SetValue(TargetYProperty, value);
        }

        // Using a DependencyProperty as the backing store for TargetY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetYProperty =
            DependencyProperty.Register(&quot;TargetY&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        #endregion

        #region Offset

        public static Point GetOffset(DependencyObject obj)
        {
            return (Point)obj.GetValue(OffsetProperty);
        }

        public static void SetOffset(DependencyObject obj, Point value)
        {
            obj.SetValue(OffsetProperty, value);
        }

        // Using a DependencyProperty as the backing store for Offset.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OffsetProperty =
            DependencyProperty.Register(&quot;Offset&quot;, typeof(Point), typeof(InertiaScrollViewer), new UIPropertyMetadata(new Point(0, 0)));
        #endregion

        #region Velocity

        public static double GetVelocityX(DependencyObject obj)
        {
            return (double)obj.GetValue(VelocityXProperty);
        }

        public static void SetVelocityX(DependencyObject obj, double value)
        {
            obj.SetValue(VelocityXProperty, value);
        }

        // Using a DependencyProperty as the backing store for VelocityX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityXProperty =
            DependencyProperty.RegisterAttached(&quot;VelocityX&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        public static double GetVelocityY(DependencyObject obj)
        {
            return (double)obj.GetValue(VelocityYProperty);
        }

        public static void SetVelocityY(DependencyObject obj, double value)
        {
            obj.SetValue(VelocityYProperty, value);
        }

        // Using a DependencyProperty as the backing store for VelocityY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityYProperty =
            DependencyProperty.Register(&quot;VelocityY&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        public double VelocityConst
        {
            get { return (double)GetValue(VelocityConstProperty); }
            set { SetValue(VelocityConstProperty, value); }
        }

        // Using a DependencyProperty as the backing store for VelocityConst.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityConstProperty =
            DependencyProperty.Register(&quot;VelocityConst&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.97));

        #endregion

        #region IsDragging

        public static bool GetIsDragging(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsDraggingProperty);
        }

        public static void SetIsDragging(DependencyObject obj, bool value)
        {
            obj.SetValue(IsDraggingProperty, value);
        }

        // Using a DependencyProperty as the backing store for IsDragging.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsDraggingProperty =
            DependencyProperty.Register(&quot;IsDragging&quot;, typeof(bool), typeof(InertiaScrollViewer), new UIPropertyMetadata(false));

        #endregion

        public bool CanDrag
        {
            get { return (bool)GetValue(CanDragProperty); }
            set { SetValue(CanDragProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CanDrag.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CanDragProperty =
            DependencyProperty.Register(&quot;CanDrag&quot;, typeof(bool), typeof(InertiaScrollViewer), new UIPropertyMetadata(false));

        #endregion
    }
</pre>
<p>Até breve,<br />
Miguel Duarte</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=28&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2009/03/13/inertiascrollviewer-scrollviewer-com-inercia-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>InertiaListBox &#8211; ListBox com inercia!!!</title>
		<link>http://wpfpt.wordpress.com/2009/03/13/inertialistbox-listbox-com-inercia/</link>
		<comments>http://wpfpt.wordpress.com/2009/03/13/inertialistbox-listbox-com-inercia/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 12:08:15 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/?p=25</guid>
		<description><![CDATA[Com o InertiaScrollViewer que podem encontrar mais abaixo tinhamos um problema ao usa-lo numa ListBox devido aos eventos do  Selector, para isso resolvi criar esta classe que nos permite ter o mesmo comportamento mas agora com uma ListBox.
Portanto, cá esta o código do .cs

  [TemplatePart(Name = &#34;PART_Scroll&#34;, Type = typeof(InertiaScrollViewer))]
    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=25&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Com o <a href="http://wpfpt.wordpress.com/2009/02/26/inertiascrollviewer-scrollviewer-com-inercia">InertiaScrollViewer</a> que podem encontrar mais abaixo tinhamos um problema ao usa-lo numa ListBox devido aos eventos do <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.selector.aspx"> Selector</a>, para isso resolvi criar esta classe que nos permite ter o mesmo comportamento mas agora com uma ListBox.</p>
<p>Portanto, cá esta o código do .cs</p>
<pre class="brush: csharp;">
  [TemplatePart(Name = &quot;PART_Scroll&quot;, Type = typeof(InertiaScrollViewer))]
    public class InertiaListBox : ListBox
    {

        #region Declara-se que
        private SelectionChangedEventArgs _selectionChangedEventArgs;
        private Point _offset;
        private Point _mouseDown;
        List&lt;object&gt; _oldSelecteds;
        #endregion

        static InertiaListBox()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(InertiaListBox), new FrameworkPropertyMetadata(typeof(InertiaListBox)));
        }

        public InertiaListBox()
        {
            _offset = new Point(0.0, 0.0);
            _selectionChangedEventArgs = null;
            _oldSelecteds = new List&lt;object&gt;();
            this.PreviewMouseDown += new MouseButtonEventHandler(InertiaListBox_PreviewMouseDown);
            Style _styleItems = new Style(typeof(ListBoxItem));
            TemplateBindingExtension b=new TemplateBindingExtension(InertiaListBox.IsSelectedProperty);
            _styleItems.Setters.Add(new Setter(Selector.IsSelectedProperty,b));
        }

        #region Eventos

        void InertiaListBox_PreviewMouseDown(object sender, MouseButtonEventArgs e)
        {
            _offset = new Point((this.Template.FindName(&quot;PART_Scroll&quot;, this) as InertiaScrollViewer).HorizontalOffset,
               (this.Template.FindName(&quot;PART_Scroll&quot;, this) as InertiaScrollViewer).VerticalOffset);
            _mouseDown = new Point(Mouse.GetPosition(this).X + _offset.X,
                Mouse.GetPosition(this).Y + _offset.Y);
        }

        #endregion

        #region Auxiliar
        private void SetIsSelected(SelectionChangedEventArgs e)
        {

                foreach (var item in _oldSelecteds)
                {
                    InertiaListBox.SetIsSelected(this.ItemContainerGenerator.ContainerFromItem(item), false);
                }
                _oldSelecteds = new List&lt;object&gt;();
                if (e != null)
                {
                    foreach (var item in e.AddedItems)
                    {
                        _oldSelecteds.Add(item);
                        InertiaListBox.SetIsSelected(this.ItemContainerGenerator.ContainerFromItem(item), true);
                    }
                }
        }
        #endregion

        #region Overrides

        protected override void OnPreviewMouseUp(MouseButtonEventArgs e)
        {
            Point _mouseUp = new Point(Mouse.GetPosition(this).X + _offset.X,
               Mouse.GetPosition(this).Y + _offset.Y);
            if (_selectionChangedEventArgs != null)
            {
                switch (Orientation)
                {
                    case Orientation.Horizontal:
                        if (Math.Abs(_mouseUp.X - _mouseDown.X) &lt; 2)
                        {
                            SetIsSelected(_selectionChangedEventArgs);
                            base.OnSelectionChanged(_selectionChangedEventArgs);
                            _selectionChangedEventArgs = null;
                        }
                        break;
                    case Orientation.Vertical:
                        if (Math.Abs(_mouseUp.Y - _mouseDown.Y) &lt; 2)
                        {
                            SetIsSelected(_selectionChangedEventArgs);
                            base.OnSelectionChanged(_selectionChangedEventArgs);
                            _selectionChangedEventArgs = null;
                        }
                        break;
                    default:
                        break;
                }
            }

            base.OnMouseUp(e);
        }

        protected override void OnSelectionChanged(SelectionChangedEventArgs e)
        {
            _selectionChangedEventArgs = e;
        }

        #endregion

        #region Properties
        public static new bool GetIsSelected(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsSelectedProperty);
        }

        public static new void SetIsSelected(DependencyObject obj, bool value)
        {
            obj.SetValue(IsSelectedProperty, value);
        }

        // Using a DependencyProperty as the backing store for IsSelected.  This enables animation, styling, binding, etc...
        public static new readonly DependencyProperty IsSelectedProperty =
            DependencyProperty.RegisterAttached(&quot;IsSelected&quot;, typeof(bool), typeof(InertiaListBox), new UIPropertyMetadata(false));

        public Orientation Orientation
        {
            get { return (Orientation)GetValue(OrientationProperty); }
            set { SetValue(OrientationProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Orientation.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OrientationProperty =
            DependencyProperty.Register(&quot;Orientation&quot;, typeof(Orientation), typeof(InertiaListBox), new UIPropertyMetadata(Orientation.Vertical));
        #endregion

    }
</pre>
<p>O template onde usamos o InertiaSrollviewer</p>
<pre class="brush: xml;">
&lt;Style TargetType=&quot;{x:Type local:InertiaListBox}&quot;&gt;
        &lt;Setter Property=&quot;Template&quot;&gt;
            &lt;Setter.Value&gt;
                &lt;ControlTemplate TargetType=&quot;{x:Type local:InertiaListBox}&quot;&gt;
                    &lt;Border Background=&quot;{TemplateBinding Background}&quot;
                            BorderBrush=&quot;{TemplateBinding BorderBrush}&quot;
                            BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;
                        &lt;local:InertiaScrollViewer Focusable=&quot;False&quot; x:Name=&quot;PART_Scroll&quot;&gt;
                           &lt;StackPanel Orientation=&quot;{TemplateBinding Orientation}&quot; IsItemsHost=&quot;True&quot; /&gt;
                        &lt;/local:InertiaScrollViewer&gt;
                    &lt;/Border&gt;
                &lt;/ControlTemplate
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
    &lt;/Style&gt;
</pre>
<p>A partir de agora e sempre que quisermos usa-la, basta definir o ItemTemplate ou o Style para ListBoxItem, por exemplo</p>
<pre class="brush: xml;">
&lt;local:InertiaListBox  Orientation=&quot;Vertical&quot;&gt;
            &lt;local:InertiaListBox.Resources&gt;
                &lt;Style TargetType=&quot;{x:Type ListBoxItem}&quot;&gt;
                    &lt;Setter Property=&quot;Template&quot;&gt;
                        &lt;Setter.Value&gt;
                            &lt;ControlTemplate TargetType=&quot;{x:Type ListBoxItem}&quot;&gt;
                                &lt;TextBlock x:Name=&quot;mov&quot; Text=&quot;{Binding .}&quot;/&gt;
                                &lt;ControlTemplate.Triggers&gt;
                                    &lt;Trigger Property=&quot;local:InertiaListBox.IsSelected&quot; Value=&quot;True&quot;&gt;
                                        &lt;Setter Property=&quot;Background&quot; TargetName=&quot;mov&quot; Value=&quot;Blue&quot;/&gt;
                                        &lt;Setter Property=&quot;Foreground&quot; TargetName=&quot;mov&quot; Value=&quot;White&quot;/&gt;
                                    &lt;/Trigger&gt;
                                &lt;/ControlTemplate.Triggers&gt;
                            &lt;/ControlTemplate&gt;
                        &lt;/Setter.Value&gt;
                    &lt;/Setter&gt;
                    &lt;Style.Triggers&gt;
                    &lt;/Style.Triggers&gt;
                &lt;/Style&gt;
            &lt;/local:InertiaListBox.Resources&gt;
        &lt;/local:InertiaListBox&gt;
</pre>
<p>Para já é tudo, confiram os updates ao InertiaScrollViewer <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Até breve,<br />
Miguel Duarte</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=25&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2009/03/13/inertialistbox-listbox-com-inercia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>FiveStarRating WPF</title>
		<link>http://wpfpt.wordpress.com/2009/03/05/fivestarrating-wpf/</link>
		<comments>http://wpfpt.wordpress.com/2009/03/05/fivestarrating-wpf/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 18:05:29 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/?p=20</guid>
		<description><![CDATA[
Boas!
Deixo-vos aqui um pequeno controlo que desenvolvi para podermos facilmente transformar qualquer pontuação numa Five Star Rating
Para isso basta definir as propriedades Value e Maximum e automaticamente temos uma FiveStarRating.

 public class FiveStarRating : ProgressBar
    {
        static FiveStarRating()
        [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=20&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://wpfpt.files.wordpress.com/2009/03/screenwpfdesktop.jpg"><img src="http://wpfpt.files.wordpress.com/2009/03/screenwpfdesktop.jpg?w=450&#038;h=281" alt="1º Screen de wpfdesktop" title="1º Screen de wpfdesktop" width="450" height="281" class="alignnone size-full wp-image-21" /></a></p>
<p>Boas!<br />
Deixo-vos aqui um pequeno controlo que desenvolvi para podermos facilmente transformar qualquer pontuação numa Five Star Rating<br />
Para isso basta definir as propriedades Value e Maximum e automaticamente temos uma FiveStarRating.</p>
<pre class="brush: csharp;">
 public class FiveStarRating : ProgressBar
    {
        static FiveStarRating()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(FiveStarRating), new FrameworkPropertyMetadata(typeof(FiveStarRating)));
        }

        #region Properties

        public Brush FrontStarBackground
        {
            get { return (Brush)GetValue(FrontStarBackgroundProperty); }
            set { SetValue(FrontStarBackgroundProperty, value); }
        }

        // Using a DependencyProperty as the backing store for FrontStarBackground.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty FrontStarBackgroundProperty =
            DependencyProperty.Register(&quot;FrontStarBackground&quot;, typeof(Brush), typeof(FiveStarRating), new UIPropertyMetadata(Brushes.YellowGreen));
        #endregion
    }
</pre>
<p>Como podem verificar o controlo deriva de uma progressbar.</p>
<p>Precisamos também deste converter</p>
<pre class="brush: csharp;">
public class ConvertValue:IMultiValueConverter
    {

        #region IMultiValueConverter Members

        public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double value = double.Parse(values[0].ToString());
            double maximum = double.Parse(values[1].ToString());
            double actualWidth = double.Parse(values[2].ToString());

            return value * actualWidth / maximum;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
        }

        #endregion
    }
</pre>
<p>E finalmente o template para o control</p>
<pre class="brush: xml;">
 &lt;local:ConvertValue x:Key=&quot;ConvertValue&quot;/&gt;
    &lt;Style TargetType=&quot;{x:Type local:FiveStarRating}&quot;&gt;
        &lt;Setter Property=&quot;Template&quot;&gt;
            &lt;Setter.Value&gt;
                &lt;ControlTemplate TargetType=&quot;{x:Type local:FiveStarRating}&quot;&gt;
                    &lt;Border
                            BorderThickness=&quot;{TemplateBinding BorderThickness}&quot;&gt;
                        &lt;Grid&gt;
                            &lt;StackPanel Orientation=&quot;Horizontal&quot; x:Name=&quot;_panelDark&quot; HorizontalAlignment=&quot;Left&quot;&gt;
                                &lt;Path  Fill=&quot;{TemplateBinding Background}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path Fill=&quot;{TemplateBinding Background}&quot;  Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path  Fill=&quot;{TemplateBinding Background}&quot;  Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path  Fill=&quot;{TemplateBinding Background}&quot;  Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path  Fill=&quot;{TemplateBinding Background}&quot;  Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                            &lt;/StackPanel&gt;
                            &lt;StackPanel Orientation=&quot;Horizontal&quot;  Grid.Row=&quot;1&quot; x:Name=&quot;_panelLight&quot; HorizontalAlignment=&quot;Left&quot;&gt;
                                &lt;StackPanel.MaxWidth&gt;
                                    &lt;MultiBinding Converter=&quot;{StaticResource ConvertValue}&quot;&gt;
                                        &lt;Binding RelativeSource=&quot;{RelativeSource TemplatedParent}&quot; Path=&quot;Value&quot; /&gt;
                                        &lt;Binding RelativeSource=&quot;{RelativeSource TemplatedParent}&quot; Path=&quot;Maximum&quot;/&gt;
                                        &lt;Binding RelativeSource=&quot;{RelativeSource TemplatedParent}&quot; Path=&quot;ActualWidth&quot;/&gt;
                                    &lt;/MultiBinding&gt;
                                &lt;/StackPanel.MaxWidth&gt;
                                &lt;Path Fill=&quot;{TemplateBinding FrontStarBackground}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path Fill=&quot;{TemplateBinding FrontStarBackground}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path Fill=&quot;{TemplateBinding FrontStarBackground}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path Fill=&quot;{TemplateBinding FrontStarBackground}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;
                                &lt;Path Fill=&quot;{TemplateBinding FrontStarBackground}&quot; Height=&quot;{TemplateBinding Height}&quot; Width=&quot;{TemplateBinding Height}&quot; RenderTransformOrigin=&quot;0.5,0.5&quot; Stretch=&quot;Fill&quot; Data=&quot;M11.490234,6.0883789 C11.576172,6.0883789 11.633463,6.1179199 11.662109,6.177002 C11.676433,6.206543 11.704184,6.3016562 11.745361,6.4623413 C11.786539,6.6230268 11.841146,6.8492842 11.90918,7.1411133 L12.376465,9.1391602 L14.41748,8.9672852 C14.703938,8.9440107 14.920572,8.9265547 15.067383,8.914917 C15.214192,8.9032803 15.291178,8.8974609 15.29834,8.8974609 C15.387857,8.8974609 15.454996,8.916708 15.499756,8.9552002 C15.544515,8.9936934 15.566895,9.0514326 15.566895,9.128418 C15.566895,9.189291 15.548991,9.2367344 15.513184,9.270752 C15.495279,9.2877607 15.417847,9.3412476 15.280884,9.4312134 C15.143921,9.5211792 14.947428,9.647624 14.691406,9.8105469 L12.972656,10.911621 L14.07373,13.672363 C14.088053,13.701009 14.095215,13.743978 14.095215,13.80127 C14.095215,13.85498 14.075521,13.90153 14.036133,13.940918 C13.996744,13.980306 13.953775,14 13.907227,14 C13.864258,14 13.819498,13.984782 13.772949,13.954346 C13.749675,13.939127 13.674927,13.878479 13.548706,13.7724 C13.422485,13.666321 13.244792,13.514811 13.015625,13.317871 L11.490234,11.996582 L9.9863281,13.296387 C9.75,13.500488 9.5671587,13.657369 9.4378052,13.767029 C9.3084507,13.876688 9.232584,13.939127 9.2102051,13.954346 C9.1654463,13.984782 9.121582,14 9.0786133,14 C9.0284834,14 8.9828291,13.979411 8.9416504,13.938232 C8.9004717,13.897054 8.8798828,13.851399 8.8798828,13.80127 C8.8798828,13.785156 8.9053955,13.709065 8.9564209,13.572998 C9.0074463,13.43693 9.0839844,13.240885 9.1860352,12.984863 L10.002441,10.911621 L8.2514648,9.7890625 C8.0043945,9.6315107 7.8148398,9.5093184 7.6828003,9.4224854 C7.5507612,9.3356533 7.4762373,9.2841797 7.4592285,9.2680664 C7.4252114,9.2358398 7.4082031,9.189291 7.4082031,9.128418 C7.4082031,9.0496416 7.4310303,8.9905596 7.4766846,8.9511719 C7.5223389,8.9117832 7.5908203,8.8920898 7.6821289,8.8920898 C7.68929,8.8920898 7.7555337,8.8974609 7.8808594,8.9082031 C8.0061846,8.9189453 8.1905928,8.9350586 8.434082,8.956543 L10.598633,9.1391602 L11.087402,7.0605469 C11.150065,6.7902021 11.200867,6.5807295 11.239807,6.4321289 C11.278748,6.2835288 11.305827,6.1958008 11.321045,6.1689453 C11.35148,6.1152344 11.407877,6.0883789 11.490234,6.0883789 z&quot; &gt;

                                &lt;/Path&gt;

                            &lt;/StackPanel&gt;
                        &lt;/Grid&gt;
                    &lt;/Border&gt;
                &lt;/ControlTemplate&gt;
            &lt;/Setter.Value&gt;
        &lt;/Setter&gt;
    &lt;/Style&gt;
</pre>
<p>Para utilizar basta:</p>
<pre class="brush: csharp;">
&lt;local:FiveStarRating HorizontalAlignment=&quot;Left&quot; Height=&quot;12&quot;
Background=&quot;Black&quot; FrontStarBackground=&quot;DarkOrange&quot; Maximum=&quot;10&quot;
Value=&quot;{Binding Path=RatingImdb}&quot;/&gt;
</pre>
<p>Aproveito para vos deixar um screen de algo que estou a desenvolver onde ja aplico este controlo</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=20&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2009/03/05/fivestarrating-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>

		<media:content url="http://wpfpt.files.wordpress.com/2009/03/screenwpfdesktop.jpg" medium="image">
			<media:title type="html">1º Screen de wpfdesktop</media:title>
		</media:content>
	</item>
		<item>
		<title>InertiaScrollViewer &#8211; ScrollViewer com inercia!</title>
		<link>http://wpfpt.wordpress.com/2009/02/26/inertiascrollviewer-scrollviewer-com-inercia/</link>
		<comments>http://wpfpt.wordpress.com/2009/02/26/inertiascrollviewer-scrollviewer-com-inercia/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 12:09:59 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/?p=13</guid>
		<description><![CDATA[Com este ScrollViewer temos a capacidade de fazer scroll apenas com o arrastar do rato
Updated

public class InertiaScrollViewer : ScrollViewer
    {
        DispatcherTimer _yourTimer;

        public InertiaScrollViewer()
        {
       [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=13&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Com este ScrollViewer temos a capacidade de fazer scroll apenas com o arrastar do rato<br />
<a href="http://wpfpt.wordpress.com/2009/03/13/inertiascrollviewer-scrollviewer-com-inercia-updated/">Updated</a></p>
<pre class="brush: csharp;">
public class InertiaScrollViewer : ScrollViewer
    {
        DispatcherTimer _yourTimer;

        public InertiaScrollViewer()
        {
            _yourTimer = new DispatcherTimer();
            _yourTimer.Interval = new TimeSpan(0, 0, 0, 0, 2);
            _yourTimer.Tick += new EventHandler(yourTimer_Tick);
            _yourTimer.Start();
            this.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            this.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
        }

        #region Overrides

        protected override void OnPreviewMouseDown(System.Windows.Input.MouseButtonEventArgs e)
        {
            base.OnMouseDown(e);
            InertiaScrollViewer.SetIsDragging(this, true);
            InertiaScrollViewer.SetTargetX(this, e.GetPosition(this).X);
            InertiaScrollViewer.SetTargetY(this, e.GetPosition(this).Y);
            double offsetx = this.HorizontalOffset - e.GetPosition(this).X;
            double offsety = this.VerticalOffset - e.GetPosition(this).Y;
            InertiaScrollViewer.SetOffset(this, new Point(offsetx, offsety));
        }

        protected override void OnMouseUp(System.Windows.Input.MouseButtonEventArgs e)
        {
            base.OnMouseUp(e);

            InertiaScrollViewer.SetTargetX(this, (e.GetPosition(this).X));
            InertiaScrollViewer.SetTargetY(this, (e.GetPosition(this).Y));
            InertiaScrollViewer.SetIsDragging(this, false);
        }

        protected override void OnMouseLeave(System.Windows.Input.MouseEventArgs e)
        {
            base.OnMouseLeave(e);
            InertiaScrollViewer.SetIsDragging(this, false);
        }

        protected override void OnPreviewMouseMove(System.Windows.Input.MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if ((InertiaScrollViewer.GetIsDragging(this) == true))
            {
                InertiaScrollViewer.SetTargetX(this, (e.GetPosition(this).X));
                InertiaScrollViewer.SetTargetY(this, (e.GetPosition(this).Y));
            }
        }

        #endregion

        private void yourTimer_Tick(object sender, EventArgs e)
        {
            if (InertiaScrollViewer.GetIsDragging(this))
            {
                double oldX = this.HorizontalOffset;
                double oldY = this.VerticalOffset;

                this.ScrollToVerticalOffset(this.VerticalOffset + (((InertiaScrollViewer.GetTargetY(this) + InertiaScrollViewer.GetOffset(this).Y) - this.VerticalOffset) * .3));
                this.ScrollToHorizontalOffset(this.HorizontalOffset + ((InertiaScrollViewer.GetTargetX(this) + InertiaScrollViewer.GetOffset(this).X) - this.HorizontalOffset) * .3);

                InertiaScrollViewer.SetVelocityX(this, (this.HorizontalOffset + ((InertiaScrollViewer.GetTargetX(this) + InertiaScrollViewer.GetOffset(this).X) - this.HorizontalOffset) * .3) - oldX);
                InertiaScrollViewer.SetVelocityY(this, (this.VerticalOffset + (((InertiaScrollViewer.GetTargetY(this) + InertiaScrollViewer.GetOffset(this).Y) - this.VerticalOffset) * .3)) - oldY);
            }
            else
            {
                if (Math.Abs(Math.Round(InertiaScrollViewer.GetVelocityX(this), 3)) != 0.000)
                {
                    this.ScrollToHorizontalOffset(this.HorizontalOffset + InertiaScrollViewer.GetVelocityX(this));
                    this.ScrollToVerticalOffset(this.VerticalOffset + InertiaScrollViewer.GetVelocityY(this));

                    InertiaScrollViewer.SetVelocityX(this, InertiaScrollViewer.GetVelocityX(this) * VelocityConst);
                    InertiaScrollViewer.SetVelocityY(this, InertiaScrollViewer.GetVelocityY(this) * VelocityConst);
                }
            }
        }

        #region Properties
        #region TargetX
        public static double GetTargetX(DependencyObject obj)
        {
            return (double)obj.GetValue(TargetXProperty);
        }

        public static void SetTargetX(DependencyObject obj, double value)
        {
            obj.SetValue(TargetXProperty, value);
        }

        // Using a DependencyProperty as the backing store for TargetX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetXProperty =
            DependencyProperty.Register(&quot;TargetX&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        #endregion

        #region TargetY
        public static double GetTargetY(DependencyObject obj)
        {
            return (double)obj.GetValue(TargetYProperty);
        }

        public static void SetTargetY(DependencyObject obj, double value)
        {
            obj.SetValue(TargetYProperty, value);
        }

        // Using a DependencyProperty as the backing store for TargetY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TargetYProperty =
            DependencyProperty.Register(&quot;TargetY&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        #endregion

        #region Offset

        public static Point GetOffset(DependencyObject obj)
        {
            return (Point)obj.GetValue(OffsetProperty);
        }

        public static void SetOffset(DependencyObject obj, Point value)
        {
            obj.SetValue(OffsetProperty, value);
        }

        // Using a DependencyProperty as the backing store for Offset.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty OffsetProperty =
            DependencyProperty.Register(&quot;Offset&quot;, typeof(Point), typeof(InertiaScrollViewer), new UIPropertyMetadata(new Point(0, 0)));
        #endregion

        #region Velocity

        public static double GetVelocityX(DependencyObject obj)
        {
            return (double)obj.GetValue(VelocityXProperty);
        }

        public static void SetVelocityX(DependencyObject obj, double value)
        {
            obj.SetValue(VelocityXProperty, value);
        }

        // Using a DependencyProperty as the backing store for VelocityX.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityXProperty =
            DependencyProperty.RegisterAttached(&quot;VelocityX&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        public static double GetVelocityY(DependencyObject obj)
        {
            return (double)obj.GetValue(VelocityYProperty);
        }

        public static void SetVelocityY(DependencyObject obj, double value)
        {
            obj.SetValue(VelocityYProperty, value);
        }

        // Using a DependencyProperty as the backing store for VelocityY.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityYProperty =
            DependencyProperty.Register(&quot;VelocityY&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.0));

        public double VelocityConst
        {
            get { return (double)GetValue(VelocityConstProperty); }
            set { SetValue(VelocityConstProperty, value); }
        }

        // Using a DependencyProperty as the backing store for VelocityConst.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty VelocityConstProperty =
            DependencyProperty.Register(&quot;VelocityConst&quot;, typeof(double), typeof(InertiaScrollViewer), new UIPropertyMetadata(0.96));

        #endregion

        #region IsDragging

        public static bool GetIsDragging(DependencyObject obj)
        {
            return (bool)obj.GetValue(IsDraggingProperty);
        }

        public static void SetIsDragging(DependencyObject obj, bool value)
        {
            obj.SetValue(IsDraggingProperty, value);
        }

        // Using a DependencyProperty as the backing store for IsDragging.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IsDraggingProperty =
            DependencyProperty.Register(&quot;IsDragging&quot;, typeof(bool), typeof(InertiaScrollViewer), new UIPropertyMetadata(false));

        #endregion
        #endregion
    }
</pre>
<p>Para usar basta definir no Template que queremos usar o nosso InertiaScrollViewer</p>
<pre class="brush: xml;">
&lt;ItemsControl&gt;
                &lt;ItemsControl.Template&gt;
                    &lt;ControlTemplate&gt;
                        &lt;local:InertiaScrollViewer&gt;
                            &lt;StackPanel IsItemsHost=&quot;True&quot;/&gt;
                        &lt;/local:InertiaScrollViewer&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/ItemsControl.Template&gt;
            &lt;/ItemsControl&gt;
</pre>
<p>Em breve vou colocar um Canvas exactamente com o mesmo funcionamento, mas para os UiElements que estão dentro dele&#8230;<br />
Até breve,<br />
Miguel Duarte</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/13/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/13/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/13/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=13&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2009/02/26/inertiascrollviewer-scrollviewer-com-inercia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>De volta. E desta vez mais activo</title>
		<link>http://wpfpt.wordpress.com/2009/02/19/de-volta-e-desta-vez-mais-activo/</link>
		<comments>http://wpfpt.wordpress.com/2009/02/19/de-volta-e-desta-vez-mais-activo/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 22:25:13 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/?p=11</guid>
		<description><![CDATA[Bem acho que vou voltar a escrever no meu blog para ajudar e poder ser ajudado sobre algumas questões sobre WPF.
Espero desta vez também ter tempo para abordar um pouco mais a tecnologia, WCF e WF.
Bem&#8230; então até breve
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=11&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Bem acho que vou voltar a escrever no meu blog para ajudar e poder ser ajudado sobre algumas questões sobre WPF.<br />
Espero desta vez também ter tempo para abordar um pouco mais a tecnologia, WCF e WF.</p>
<p>Bem&#8230; então até breve</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=11&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2009/02/19/de-volta-e-desta-vez-mais-activo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>Tranformar Array Bytes em BitmapImage</title>
		<link>http://wpfpt.wordpress.com/2007/03/26/tranformar-array-bytes-em-bitmapimage/</link>
		<comments>http://wpfpt.wordpress.com/2007/03/26/tranformar-array-bytes-em-bitmapimage/#comments</comments>
		<pubDate>Mon, 26 Mar 2007 16:16:45 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/2007/03/26/tranformar-array-bytes-em-bitmapimage/</guid>
		<description><![CDATA[Deixo-vos aqui uma pequena função que nos permite transformar um Byte[] em BitmapImage, bastante útil quando guardamos imagens  em base de dados ou transferindo por webServices!!


/// &#60;summary&#62;
/// Obter uma imagem atravez de um array de bytes
/// &#60;/summary&#62;
/// &#60;param name=&#8221;arraybytes&#8221;&#62;array de bytes&#60;/param&#62;
/// &#60;returns&#62;devolve um BitmapImage que podemos adicionar á source &#60;/returns&#62;
/// &#60;example&#62;Obj.source=getImage(byte[])&#60;/example&#62;
BitmapImage getImage(byte[] arraybytes)
{
    // [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=6&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Deixo-vos aqui uma pequena função que nos permite transformar um Byte[] em BitmapImage, bastante útil quando guardamos imagens  em base de dados ou transferindo por webServices!!<br />
<!-- {\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 \cf15 ///\cf11  \cf15 &lt;summary&gt;\par ??///\cf11  Obter uma imagem atravez de um array de bytes\par ??\cf15 ///\cf11  \cf15 &lt;/summary&gt;\par ??///\cf11  \cf15 &lt;param name="arraybytes"&gt;\cf11 array de bytes\cf15 &lt;/param&gt;\par ??///\cf11  \cf15 &lt;returns&gt;\cf11 devolve um BitmapImage que podemos adicionar \'e1 source \cf15 &lt;/returns&gt;\par ??///\cf11  \cf15 &lt;example&gt;\cf11 Obj.source=getImage(byte[])\cf15 &lt;/example&gt;\par ??\cf10 BitmapImage\cf0  getImage(\cf2 byte\cf0 [] arraybytes)\par ??\{\par ??    \cf11 // Criar a Imagem\par ??\cf0     \cf11 // NOTE: Isto n \'e9 um Bitmap normal (GDI+)\par ??\cf0     \cf10 BitmapImage\cf0  bitmap = \cf2 new\cf0  \cf10 BitmapImage\cf0 ();\par ??    \cf2 if\cf0  (arraybytes != \cf2 null\cf0 )\par ??    \{\par ??        \cf10 MemoryStream\cf0  strm = \cf2 new\cf0  \cf10 MemoryStream\cf0 (arraybytes);\par ??        bitmap.BeginInit();\par ??        bitmap.StreamSource = strm;\par ??        bitmap.EndInit();\par ??    \}\par ??    \cf11 //COMMENT: Retorna a Imagem\par ??\cf0    \cf2 return\cf0  bitmap;\par ??\}} --></p>
<p style="background:white none repeat scroll 0 50%;font-family:Courier New;font-size:10pt;color:black;">
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;">&lt;summary&gt;</span></p>
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> Obter uma imagem atravez de um array de bytes</span></p>
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;">&lt;/summary&gt;</span></p>
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;">&lt;param name=&#8221;arraybytes&#8221;&gt;</span><span style="color:green;">array de bytes</span><span style="color:gray;">&lt;/param&gt;</span></p>
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;">&lt;returns&gt;</span><span style="color:green;">devolve um BitmapImage que podemos adicionar á source </span><span style="color:gray;">&lt;/returns&gt;</span></p>
<p style="margin:0;"><span style="color:gray;">///</span><span style="color:green;"> </span><span style="color:gray;">&lt;example&gt;</span><span style="color:green;">Obj.source=getImage(byte[])</span><span style="color:gray;">&lt;/example&gt;</span></p>
<p style="margin:0;"><span style="color:teal;">BitmapImage</span> getImage(<span style="color:blue;">byte</span>[] arraybytes)</p>
<p style="margin:0;">{</p>
<p style="margin:0;">    <span style="color:green;">// Criar a Imagem</span></p>
<p style="margin:0;">    <span style="color:green;">// NOTE: Isto n é um Bitmap normal (GDI+)</span></p>
<p style="margin:0;">    <span style="color:teal;">BitmapImage</span> bitmap = <span style="color:blue;">new</span> <span style="color:teal;">BitmapImage</span>();</p>
<p style="margin:0;">    <span style="color:blue;">if</span> (arraybytes != <span style="color:blue;">null</span>)</p>
<p style="margin:0;">    {</p>
<p style="margin:0;">        <span style="color:teal;">MemoryStream</span> strm = <span style="color:blue;">new</span> <span style="color:teal;">MemoryStream</span>(arraybytes);</p>
<p style="margin:0;">        bitmap.BeginInit();</p>
<p style="margin:0;">        bitmap.StreamSource = strm;</p>
<p style="margin:0;">        bitmap.EndInit();</p>
<p style="margin:0;">    }</p>
<p style="margin:0;">    <span style="color:green;">//COMMENT: Retorna a Imagem</span></p>
<p style="margin:0;">   <span style="color:blue;">return</span> bitmap;</p>
<p style="margin:0;">}</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wpfpt.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wpfpt.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=6&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2007/03/26/tranformar-array-bytes-em-bitmapimage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>Blend Release Candidate</title>
		<link>http://wpfpt.wordpress.com/2007/03/16/blend-release-candidate/</link>
		<comments>http://wpfpt.wordpress.com/2007/03/16/blend-release-candidate/#comments</comments>
		<pubDate>Fri, 16 Mar 2007 15:31:43 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/2007/03/16/blend-release-candidate/</guid>
		<description><![CDATA[Já está diponível  para download a nova RC do Microsoft Blend que pode ser descarregada em:
http://www.microsoft.com/products/expression/en/expression-blend/try.mspx

Aproveito também para deixar uns vídeos a todos aqueles que tal como eu se pretendem iniciar em WPF com umas brincadeiras engraçadas.
Real-world WPF: Introduction to Blend (Part1) 
Real-world WPF: Introduction to Blend (Part2) 
Real-world WPF: Introduction to Blend (Part3) 
Real-world [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=5&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p class="postbody">Já está diponível  para download a nova RC do Microsoft Blend que pode ser descarregada em:</p>
<p><span style="font-size:12pt;font-family:'Calibri','sans-serif';"><a href="http://www.microsoft.com/products/expression/en/expression-blend/try.mspx" title="http://www.microsoft.com/products/expression/en/expression-blend/try.mspx"><font color="#0000ff">http://www.microsoft.com/products/expression/en/expression-blend/try.mspx</font></a></span></p>
<p><span style="font-size:12pt;font-family:'Calibri','sans-serif';"></span></p>
<p><span style="font-size:12pt;font-family:'Calibri','sans-serif';">Aproveito também para deixar uns vídeos a todos aqueles que tal como eu se pretendem iniciar em WPF com umas brincadeiras engraçadas.</span></p>
<p><span style="font-size:12pt;font-family:'Calibri','sans-serif';"><span style="font-size:8.5pt;font-family:'Verdana','sans-serif';"><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=286758#286758"><font color="#0000ff">Real-world WPF: Introduction to Blend (Part1) </font></a></span></p>
<p><span style="font-size:8.5pt;font-family:'Verdana','sans-serif';"><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=286763#286763"><font color="#0000ff">Real-world WPF: Introduction to Blend (Part2) </font></a></span></p>
<p><span style="font-size:8.5pt;font-family:'Verdana','sans-serif';"><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=286767#286767"><font color="#0000ff">Real-world WPF: Introduction to Blend (Part3) </font></a></span></p>
<p><span style="font-size:8.5pt;font-family:'Verdana','sans-serif';"><a href="http://channel9.msdn.com/ShowPost.aspx?PostID=286773#286773"><font color="#0000ff">Real-world WPF: Introduction to Blend (Part4) </font></a></span></p>
<p></span></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wpfpt.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wpfpt.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=5&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2007/03/16/blend-release-candidate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>TECH DAYS &#8211; 2007 &#8211; A minha Agenda!</title>
		<link>http://wpfpt.wordpress.com/2007/03/16/tech-days-2007-a-minha-agenda/</link>
		<comments>http://wpfpt.wordpress.com/2007/03/16/tech-days-2007-a-minha-agenda/#comments</comments>
		<pubDate>Fri, 16 Mar 2007 15:13:13 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/2007/03/16/tech-days-2007-a-minha-agenda/</guid>
		<description><![CDATA[O Tech Days é já para a semana e então já estive a fazer a minha agenda!
Vou ter que me dividir em 2 por algumas vezes&#8230;
As minhas Sessões


20
10:00
People Ready                           [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=4&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>O Tech Days é já para a semana e então já estive a fazer a minha agenda!</p>
<p>Vou ter que me dividir em 2 por algumas vezes&#8230;</p>
<h1>As minhas Sessões</h1>
<table>
<tr>
<td valign="top"><strong>20</strong></td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=20&amp;Hour=10_00" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl00_HyperLink2" title="Carregue aqui para adicionar uma sessão">10:00</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/KEY001" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl00_HyperLink1">People Ready</a></strong>                                         KEY001                                                                                    Sala                             A1</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=20&amp;Hour=12_00" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl01_HyperLink2" title="Carregue aqui para adicionar uma sessão">12:00</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV001" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl01_HyperLink1">.NET 3.0 &#8211; Plataforma de Desenvolvimento</a></strong>                                         DEV001                                                                                    Sala                             A1</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=20&amp;Hour=14_15" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl02_HyperLink2" title="Carregue aqui para adicionar uma sessão">14:15</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV002" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl02_HyperLink1">The Microsoft Web Story: ASP.NET 2.0, ASP.NET AJAX, and WPF/E</a></strong>                                         DEV002                                                                                    Sala                             A1</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=20&amp;Hour=16_00" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl03_HyperLink2" title="Carregue aqui para adicionar uma sessão">16:00</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV006" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl03_HyperLink1">Windows Presentation Foundation I</a></strong>                                         DEV006                                                                                    Sala                             A8</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=20&amp;Hour=17_45" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl04_HyperLink2" title="Carregue aqui para adicionar uma sessão">17:45</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV004" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl04_HyperLink1">Desenvolvimento de Jogos com XNA Express</a></strong>                                         DEV004                                                                                    Sala                             A1</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">&nbsp;</td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV007" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl05_HyperLink1">Introdução ao Windows Workflow Foundation</a></strong>                                         DEV007                                                                                    Sala                             A8</td>
</tr>
<tr>
<td valign="top"><strong>21</strong></td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=21&amp;Hour=09_30" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl06_HyperLink2" title="Carregue aqui para adicionar uma sessão">09:30</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/MOB001" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl06_HyperLink1">Desenvolvimento de Aplicações para Windows Mobile</a></strong>                                         MOB001                                                                                    Sala                             A4</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=21&amp;Hour=11_15" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl07_HyperLink2" title="Carregue aqui para adicionar uma sessão">11:15</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV012" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl07_HyperLink1">Windows Presentation Foundation II</a></strong>                                         DEV012                                                                                    Sala                             A7</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top">&nbsp;</td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEVHOL03" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl08_HyperLink1">Getting Started with Windows Workflow Foundation</a></strong>                                         DEVHOL03                                                                                    Sala                             S1.06</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=21&amp;Hour=13_30" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl09_HyperLink2" title="Carregue aqui para adicionar uma sessão">13:30</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DAT002" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl09_HyperLink1">SQL Server 2005: Repositório de Dados Empresarial com o SQL Server Integration Services &amp; Reporting Services</a></strong>                                         DAT002                                                                                    Sala                             A4</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=21&amp;Hour=15_15" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl10_HyperLink2" title="Carregue aqui para adicionar uma sessão">15:15</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV015" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl10_HyperLink1">Introdução ao Windows Communication Foundation</a></strong>                                         DEV015                                                                                    Sala                             A6</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=21&amp;Hour=17_00" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl11_HyperLink2" title="Carregue aqui para adicionar uma sessão">17:00</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV017" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl11_HyperLink1">Novas APIs para Reconhecimento e Síntese de Fala em Português para Aplicações Cliente e Servidor</a></strong>                                         DEV017                                                                                    Sala                             A8</td>
</tr>
<tr>
<td valign="top"><strong>22</strong></td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=09_30" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl12_HyperLink2" title="Carregue aqui para adicionar uma sessão">09:30</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/INT004" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl12_HyperLink1">Healthcare &#8211; Integração de Sistemas  usando HL7</a></strong>                                         INT004                                                                                    Sala                             S1.08</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=11_15" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl13_HyperLink2" title="Carregue aqui para adicionar uma sessão">11:15</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV020" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl13_HyperLink1">Extensibilidade do Windows Workflow Foundation com Custom Activities</a></strong>                                         DEV020                                                                                    Sala                             A7</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=13_30" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl14_HyperLink2" title="Carregue aqui para adicionar uma sessão">13:30</a></td>
<td><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=13_30" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl14_x" title="Carregue aqui para adicionar uma sessão"><img src="http://techdays.canoas.com/Agenda/images/calendar_add.png" style="border-width:0;" /></a></td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=15_15" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl15_HyperLink2" title="Carregue aqui para adicionar uma sessão">15:15</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV024" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl15_HyperLink1">Construir Serviços WCF com WF &#8211; Presente e Futuro</a></strong>                                         DEV024                                                                                    Sala                             A7</td>
</tr>
<tr>
<td valign="top">&nbsp;</td>
<td valign="top"><a href="http://techdays.canoas.com/Agenda/AddFromSlot.aspx?Day=22&amp;Hour=17_00" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl16_HyperLink2" title="Carregue aqui para adicionar uma sessão">17:00</a></td>
<td><strong><a href="http://techdays.canoas.com/Agenda/Sessao.aspx/DEV025" id="ctl00_centerColPlaceHolder_sessionsRepeaterNew_ctl16_HyperLink1">Segurança na Windows Communication Foundation: objectivos, modelos, padrões e pontos de extensão</a></strong>                                         DEV025                                                                                    Sala                             A3</td>
</tr>
</table>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wpfpt.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wpfpt.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=4&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2007/03/16/tech-days-2007-a-minha-agenda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>

		<media:content url="http://techdays.canoas.com/Agenda/images/calendar_add.png" medium="image" />
	</item>
		<item>
		<title>O que fazer com um projecto Antigo??</title>
		<link>http://wpfpt.wordpress.com/2007/03/12/o-que-fazer-com-um-projecto-antigo/</link>
		<comments>http://wpfpt.wordpress.com/2007/03/12/o-que-fazer-com-um-projecto-antigo/#comments</comments>
		<pubDate>Mon, 12 Mar 2007 19:10:38 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://wpfpt.wordpress.com/2007/03/12/o-que-fazer-com-um-projecto-antigo/</guid>
		<description><![CDATA[Aqui vamos meu primeiro Post, e vou começar por uma questão que fiz a mim mesmo quando comecei a desenvolver em wpf num projecto &#8220;a sério&#8221;.
O que vou fazer com os módulos  que já tenho, recomeçar tudo de novo??
A resposta a  esta pergunta é simples&#8230; não&#8230; posso integrar XAML em Windows Forms e [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=3&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Aqui vamos meu primeiro Post, e vou começar por uma questão que fiz a mim mesmo quando comecei a desenvolver em wpf num projecto &#8220;a sério&#8221;.</p>
<p><strong>O que vou fazer com os módulos  que já tenho, recomeçar tudo de novo??</strong></p>
<p>A resposta a  esta pergunta é simples&#8230; não&#8230; posso integrar XAML em Windows Forms e Windows Forms (Aqui quando me refiro a Windows Forms estou-me a referir controls/Usercontrols)  em XAML.<br />
Para isso basta usar o namespace System.Windows.Forms.Integration</p>
<p>Para integrar XAML em Windows Forms fazemos:<br />
<code><br />
//Declarar/Construir o Host para colacar XAML dentro de uma Windows Form Framework 2.0<br />
System.Windows.Forms.Integration.ElementHost HostdeXAML = new System.Windows.Forms.Integration.ElementHost();<br />
//Declarar o UserControl de XAML<br />
ClassXAML child = new ClassXAML();<br />
HostdeXAML .Child=child;<br />
HostdeXAML.Dock = DockStyle.Fill;<br />
this.Controls.Add(HostdeXAML);</code></p>
<p>Para integrar Windows Forms  em XAML fazemos:<br />
<code> System.Windows.Forms.Integration.WindowsFormsHost HostdeForms = new System.Windows.Forms.Integration.WindowsFormsHost();<br />
ClassForms child = new ClassForms();<br />
HostdeForms.Child=child;<br />
HostdeForms.Margin=new System.Windows.Thickness(0);<br />
HostdeForms.Child = child;<br />
System.Windows.Controls.Grid.SetRow(HostdeForms, 0);<br />
System.Windows.Controls.Grid.SetColumn(HostdeForms, 0);<br />
myGrid.Children.Add(HostdeForms);<br />
</code></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wpfpt.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wpfpt.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=3&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2007/03/12/o-que-fazer-com-um-projecto-antigo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://wpfpt.wordpress.com/2007/03/12/hello-world/</link>
		<comments>http://wpfpt.wordpress.com/2007/03/12/hello-world/#comments</comments>
		<pubDate>Mon, 12 Mar 2007 17:31:43 +0000</pubDate>
		<dc:creator>soulonfire</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Bem Vindos ao meu Blog!
Este Blog terá como objectivo divulgar Windows Presentation Foundation (WPF) em PT
Espero que todos possam usufruir e contribuir para o crescimento do Blog!!
       <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=1&subd=wpfpt&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Bem Vindos ao meu Blog!</p>
<p>Este Blog terá como objectivo divulgar Windows Presentation Foundation (WPF) em PT</p>
<p>Espero que todos possam usufruir e contribuir para o crescimento do Blog!!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wpfpt.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wpfpt.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wpfpt.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wpfpt.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wpfpt.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wpfpt.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wpfpt.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wpfpt.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wpfpt.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wpfpt.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wpfpt.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wpfpt.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wpfpt.wordpress.com&blog=867901&post=1&subd=wpfpt&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wpfpt.wordpress.com/2007/03/12/hello-world/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/b280017ff2d035595bb094120bc0398f?s=96&#38;d=identicon" medium="image">
			<media:title type="html">soulonfire</media:title>
		</media:content>
	</item>
	</channel>
</rss>