(X) Hide this Upcoming webinar on Feb 23rd, 10 am PST (see your local time): Building Line-of-business Applications with Silverlight & WCF Data Services
More webinar info | Register | Other webinars
Tweet @silverlightshow and win a SilverlightShow Tweet-shirt. Learn how >>
Skip Navigation LinksHome / News / View News

Search

 
Results Per Page

Found 10 results for Attached Properties.
Date between: <not defined> and <not defined>
Search in: News , Articles , Tips , Shows , Showcase , Books

Order by Publish Date   Ascending Title   Rating  

  • 0 comments  /  posted by  Gill Cleeren  on  Feb 01, 2011 (3 weeks ago)
    SilverlightShow and Gill Cleeren start a series of materials aimed at helping you get prepared for taking Microsoft Silverlight Exam 70-506. Through this series we will try to structure the resources available on the internet, grouping them by topic covered in the exam. Any feedback would be much appreciated! Thanks! 

    This article is Part 3 of the series on Microsoft Silverlight Exam:

    In the previous parts of this series on getting yourself ready for the Silverlight exam, we mainly looked at UI related items. In the very first part, we looked at how Silverlight could help with layout, navigation, media and the core controls. In part 2, we focused on the many features Silverlight has on board to create better user interfaces, such as the Visual State Manager, styling, templating and animations.

    This third part is going to be more aimed at the code-side of things. We’ll start our journey by looking at specifics of Silverlight such as routed events (these also exist in WPF by the way and asynchronous communication with services.



  • 0 comments  /  posted by  Silverlight Show  on  Aug 02, 2010 (6 months ago)
    Phil Middlemiss has created a sample application with a single Dial UserControl scaled to a couple of different sizes.

    I used the PathListBox control for the dial numbers and lights. If you haven’t used the Path ListBox before then here is a good series on it. The finished UserControl has a MaxValue property that lets you specify how many numbers should appear on the dial, but at the start I just had a the shapes for the dial and used a PathListBox with some fixed items in it.

    The first challenge was to get the PathListBoxItem control template to show a mix of orientations. There are two kinds of orientations you can have with a PathListBox: None and OrientToPath.

  • A Chrome and Glass Theme - Part 8

    0 comments  /  posted by  Silverlight Show  on  Jun 28, 2010 (8 months ago)
    In the next part from the series, Phil Middlemiss demonstrates how he made the radio buttons he blogged about previously.

    These buttons have gone through many iterations and I’m still not sure I’m quite happy with them just yet, but I’ll cover them anyway since they introduce a few interesting attached properties.

    If you are not familiar with Phil's series, you better first read his introductory post.
  • 0 comments  /  posted by  Silverlight Show  on  Jun 16, 2010 (8 months ago)
    Take a look at this cool Expression Blend post of Phil Middlemiss on rounding off buttons.

    I have the following requirements for this radio button style:

    • It must be re-sizable
    • The rounded ends must stay perfect half circles in proportion to the height of the button
    • It must behave correctly in Blend
    • Optional Extra: It would be nice to not have to manually edit XAML in Blend


  • 1 comments  /  posted by  Silverlight Show  on  Sep 04, 2009 (more than a year ago)
    If you want to have a default button clicked when an enter key is pressed in a textbox within a Silverlight or WPF application then read this post of David Justice and find the solution. 

    I was working with a client that wanted to have a default button clicked when an enter key is pressed in a textbox (password box to be more specific) within a Silverlight or WPF application. I didn't think much of it. I'll just listen to the event, bind to the button, and click the button on the enter key event. The listening and binding portion is not very tough with an attached property and a little Silverlight 3 element to element binding love. The tricky part came in when I wanted to cause the button click event to be raised.

  • 0 comments  /  posted by  Silverlight Show  on  Jun 11, 2009 (more than a year ago)
    Michael Sync is trying to solve a problem with UpdateSourceTrigger which is not supported in Silverlight until version 3.o.

    You will need to set the focus on other controls and re-focus to the control that you are using. For example: You are typing in TextBoxA. You want to have UpdateSourceTrigger support for that textbox. So, what you have to do is that you need to change the focus on another control (e.g. TextboxB) and re-set the focus on TextboxA while typing.

  • 0 comments  /  posted by  Silverlight Show  on  May 30, 2009 (more than a year ago)

    Bob Bartholomay wanted to get a reference to a FrameworkElement that was created dynamically and animated but realized that he can't get such a reference. The solution of the problem is called Attached Properties.

    I had a need to create FrameworkElement(s) dynamically, animate them, and then get rid of them. I was surprised to find that while you have the (say) DoubleAnimation as one of the parameters in the Animation’s Completed handler, there’s no way to find out what FrameworkElement that Animation just animated - I want to remove that element from the visual tree.

  • 2 comments  /  posted by  Ilia Iordanov  on  Sep 10, 2008 (more than a year ago)

    Probably the first most important thing to mention here is that only inheritors of System.Windows.DependencyObject can be extended with attached properties. This is needed because either to set or to get value for a specific attached property, you need to use the methods SetValue and GetValue which are defined in the DependencyObject class.
    When you declare an attached property, many advantages from the dependency properties model are coming out of the box for you such as caching, data binding, default values, expressions, styling, property invalidation and more.

    In order to declare a attached property in Silverlight, you have to follow few simple steps as explained in the sample code below.

    C#

    public partial class MySilverlightControl : StackPanel
    {
        //1. Declare the attached property as static, readonly field in your class.
       public static readonly DependencyProperty MyPropertyProperty = DependencyProperty.RegisterAttached(
                  "MyProperty",                                 //Property name
                  typeof( string ),                             //Property type
                  typeof( MySilverlightControl ),               //Type of the dependency property provider
                  new PropertyMetadata( MyPropertyChanged ) )//Callback invoked on property value change
     
        public MySilverlightControl()
        {
            InitializeComponent();
        }
     
        //2. Define the appropriate SetXXX and GetXXX methods, 
        //where XXX should be replaced with the property name
        public static void SetMyProperty( DependencyObject obj, string propertyValue )
        {
            obj.SetValue( MyPropertyProperty, propertyValue );
        }
        public static string GetMyProperty( DependencyObject obj )
        {
            return ( string )obj.GetValue( MyPropertyProperty );
        }
     
        private static void MyPropertyChanged( object sender, DependencyPropertyChangedEventArgs args )
        {
            //Do some processing here when the attached property value has changed...
        }
     
        //Just a sample method illustrating the idea how to obtain the value
        //of the MyProperty property for a specific element.
        private void ProcessTabKey()
        {
            foreach ( UIElement element in this.Children )
            {
                string propertyValue = MySilverlightControl.GetMyProperty( element );
                //Perform some processing according to the my property value.............
            }
        }
    }

    Read more about DependencyObject and DependencyProperty classes on MSDN.
    If you need more information about the attached properties check out this article 'Attached properties in Silverlight'.

    That's it!

  • 8 comments  /  posted by  Ilia Iordanov  on  Jun 02, 2008 (more than a year ago)
    This article is compatible with the latest version of Silverlight.


    1.       Introduction
    An attached property is a new concept that is defined by Extensible Application Markup Language (XAML). The attached properties are intended to be used as global properties that are settable on any type of object. In WPF/Silverlight, attached properties are typically defined as a form of a dependency property that does not have the conventional property 'wrapper'.
     
    2.       What attached properties are?
    The main ability of the attached properties is to allow different child elements to specify unique values for a property that is actually defined in a parent element...
  • 0 comments  /  posted by  Emil Stoychev  on  Jun 01, 2008 (more than a year ago)

    While playing with the ListBox control I want to set the ScrollViewer's VerticalScrollBarVisibility/HorizontalScrollBarVisibility properties in the XAML. The following code illustrates how to do it:

    <ListBox x:Name="StatusList" 
    ScrollViewer.HorizontalScrollBarVisibility="Hidden">
        ...
    </ListBox>