0 people like it.
Like the snippet!
WPF/Silverlight Attached Property
Example of a WPF/Silverlight Attached Property (AP). This is a port of a C# AP implementation that can be found at http://www.silverlightshow.net/items/Attached-Properties-in-Silverlight.aspx.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
|
open System.Windows
open System.Windows.Controls
// Example ported from http://www.silverlightshow.net/items/Attached-Properties-in-Silverlight.aspx
type TabPanel() =
inherit StackPanel()
/// Register the attached property
static member TabStopProperty =
DependencyProperty.RegisterAttached("TabStop", typeof<bool>, typeof<TabPanel>, null)
/// Set the property
static member SetTabStop (element:UIElement) (value:obj) =
let _, boolValue = bool.TryParse (string value)
element.SetValue(TabPanel.TabStopProperty, boolValue)
/// Get the property
static member GetTabStop (element:UIElement) =
element.GetValue TabPanel.TabStopProperty
|
namespace System
namespace System.Windows
Multiple items
type TabPanel =
inherit obj
new : unit -> TabPanel
static member GetTabStop : element:'a -> 'b
static member SetTabStop : element:'a -> value:obj -> 'b
static member TabStopProperty : 'a
Full name: Script.TabPanel
--------------------
new : unit -> TabPanel
static member TabPanel.TabStopProperty : 'a
Full name: Script.TabPanel.TabStopProperty
Register the attached property
val typeof<'T> : System.Type
Full name: Microsoft.FSharp.Core.Operators.typeof
type bool = System.Boolean
Full name: Microsoft.FSharp.Core.bool
static member TabPanel.SetTabStop : element:'a -> value:obj -> 'b
Full name: Script.TabPanel.SetTabStop
Set the property
type obj = System.Object
Full name: Microsoft.FSharp.Core.obj
System.Boolean.TryParse(value: string, result: byref<bool>) : bool
Multiple items
val string : value:'T -> string
Full name: Microsoft.FSharp.Core.Operators.string
--------------------
type string = System.String
Full name: Microsoft.FSharp.Core.string
property TabPanel.TabStopProperty: 'a
Register the attached property
static member TabPanel.GetTabStop : element:'a -> 'b
Full name: Script.TabPanel.GetTabStop
Get the property
More information