Posts Tagged ‘Behavior’
19
Nov

Fluid Move Behavior

Post a comment » Popularity: 8%

Kirupa has released a fantastic animation behavior called “Fluid Move”. The items inside the Grid will arrange in an animated way according to the size change.

Fluid Move Behavior

View Demo: New Window
02
Nov

Magnifying glass effect

Post a comment » Popularity: 8%
Jeff Prosise shared a reusable Magnifying Glass effect behavior. Click on the screen and you are able to magnify your view.

Magnifying glass effect

View Demo: New Window
27
Oct

Creating Behaviors and Triggers

Post a comment » Popularity: 12%

Jeremy posted an article guiding you the details of creating behaviors and triggers. His article also illustrated how you may build a behavior to limit the characters that can be typed to Textbox.

Creating Behaviors and Triggers 

05
Oct

Open ComboBox by Mouse Over

Post a comment » Popularity: 32%

Jacek Ciereszko created an behavior class which allow users to open the combobox menu without mouse click. Simply move over the control and it will open automatically.

Open ComboBox by Mouse Over

View Demo: New Window
24
Sep

Invoke Button click event

Post a comment » Popularity: 1%

Jacek Ciereszko shared the solution of invoking a button click event without user interaction on the button. He has also wrapped up the logic into behavior in which you can reuse the feature easily.

Invoke Button click event

View Demo: New Window
23
Sep

Clip/Mask To Actual Size

Post a comment » Popularity: 1%

Colin Eberhardt created a very useful Clipping behavior class which helps you do clipping easily. The behavior can detect the ActualHeight and ActualWidth at run time and create a RectangleGeometry() to Clip your Grid.

Clip To Bounds

c# implementation of the behavior:
using System;
using System.Windows;

namespace Namespace
{

    public class Clip
    {
        public static bool GetToBounds(DependencyObject depObj)
        {
            return (bool)depObj.GetValue(ToBoundsProperty);
        }

        public static void SetToBounds(DependencyObject depObj, bool clipToBounds)
        {
            depObj.SetValue(ToBoundsProperty, clipToBounds);
        }

        /// <summary>
        /// Identifies the ToBounds Dependency Property.
        /// <summary>
        public static readonly DependencyProperty ToBoundsProperty =
        DependencyProperty.RegisterAttached("ToBounds", typeof(bool),
        typeof(Clip), new PropertyMetadata(false, OnToBoundsPropertyChanged));

        private static void OnToBoundsPropertyChanged(DependencyObject d,
        DependencyPropertyChangedEventArgs e)
        {
        FrameworkElement fe = d as FrameworkElement;
        if (fe != null)
        {
            ClipToBounds(fe);

            // whenever the element which this property is attached to is loaded
            // or re-sizes, we need to update its clipping geometry
            fe.Loaded += new RoutedEventHandler(fe_Loaded);
            fe.SizeChanged += new SizeChangedEventHandler(fe_SizeChanged);

        }
        }

        /// <summary>
        /// Creates a rectangular clipping geometry which matches the geometry of the
        /// passed element
        /// </summary>
        private static void ClipToBounds(FrameworkElement fe)
        {
        if (GetToBounds(fe))
        {
            fe.Clip = new RectangleGeometry()
            {
            Rect = new Rect(0, 0, fe.ActualWidth, fe.ActualHeight)
            };
        }
        else
        {
            fe.Clip = null;
        }
        }

        static void fe_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            ClipToBounds(sender as FrameworkElement);
        }

        static void fe_Loaded(object sender, RoutedEventArgs e)
        {
            ClipToBounds(sender as FrameworkElement);
        }
    }
}
sample usage in XAML:
<UserControl x:Class="Namespace.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:this="clr-namespace:Namespace;assembly=Namespace"
    >
    <Grid x:Name="LayoutRoot"  this:Clip.ToBounds="True" >

    </Grid>
</UserControl>
22
Sep

Farseer Physics Helper 3

Post a comment » Popularity: 1%

Andy created a lot of handy Farseer behaviors which allows you to create physics object easily using Expression Blend 3. You don’t have to write any coding anymore.

Farseer Physics Helper 3

View Demo: New Window
22
Sep

Fluid Behavior Container

Post a comment » Popularity: 1%

A very useful behaviors to simulate water, waves and also objects inside the water medium. Very funny example.

Fluid-Behavior-Container

View Demo: New Window