Silverlight lives on in XAML. Visual Studio supports XAML but has lost the visual XAML editor. It's ok.
Showing posts with label silverlight. Show all posts
Showing posts with label silverlight. Show all posts
Sunday, 24 August 2025
Sunday, 25 August 2013
All you wanted to know about WPF (and Silverlight) StackPanel..
StackPanel is a bit like a ToolBar that instead of going from left to right or right to left, goes top to bottom (in the default case). Although a StackPanel is actually more flexible..as it can also go from left to right, simply by setting the attribute Orientation="Horizontal". As common with WPF controls, this one has been around since .NET 3.0 and is also included in Silverlight. It inherits from System.Windows.Controls.Panel which inherits from System.Windows.FrameworkElement (from PresentationFramework.dll). Interestingly, the same inheritance structure is true also for Silverlight! However, the dll in which is class is contained is quite different (System.Windows.dll).
Saturday, 11 February 2012
What are DEPENDENCY properties in Silverlight?
Remember, that Silverlight is a mere microcosm of a bigger library known as the behemoth WPF. So when we discuss the Silverlight property system what we are really talking about it just a small subset of what might be known as the "WPF" property system. So there you go.
The Silverlight property system (TM) provides ways to EXTEND the CLR PROPERTY SYSTEM. You all heard that, right? We are EXTENDING THE CLR PROPERTY SYSTEM. Great. A dependency property is, quite simply, a property that is backed by the SL property system is most appreciatingly known as a DEPENDENCY PROPERTY.
Dependency properties, as their name suggests, are fundamentally about dependencies. We want a property to AUTO-COMPUTE based on the value of other properties. In this way, we might think of dependency properties, as nothing more than the oh-so-ordinary appellation called "dependent" properties, but we call them more fancy names, like "dependency" properties. "Dependency" does sound a lot cooler than "dependent".
Some rules of the game: a dependency property must be on a DependencyObject. They are usually public static and readonly members.
The Silverlight property system (TM) provides ways to EXTEND the CLR PROPERTY SYSTEM. You all heard that, right? We are EXTENDING THE CLR PROPERTY SYSTEM. Great. A dependency property is, quite simply, a property that is backed by the SL property system is most appreciatingly known as a DEPENDENCY PROPERTY.
Dependency properties, as their name suggests, are fundamentally about dependencies. We want a property to AUTO-COMPUTE based on the value of other properties. In this way, we might think of dependency properties, as nothing more than the oh-so-ordinary appellation called "dependent" properties, but we call them more fancy names, like "dependency" properties. "Dependency" does sound a lot cooler than "dependent".
Some rules of the game: a dependency property must be on a DependencyObject. They are usually public static and readonly members.
Please explain the WPF concept of DATA TEMPLATING
A very good question. Now you are understanding what it takes to be a WPF master. You CAN get away without understanding this concept, but you will NOT be a master. It is part of the knowledge base relating to "WPF Styling and Templating".
Practical, simple example of DATA TEMPLATING. You have a ListBox and want to configure how items are displayed in it. You can define a DATA TEMPLATE within the ITEM TEMPLATE tag (ListBox.ItemTemplate) within the "SCOPE" of the ListBox. The formatting declarations would then appear within a tag entitled <DataTemplate>. We can also define the DataTemplate within the Resources section of XAML to make it a reusable object. The DT defines HOW DATA APPEARS including appropriate bindings for textual information, borders etc.
Practical, simple example of DATA TEMPLATING. You have a ListBox and want to configure how items are displayed in it. You can define a DATA TEMPLATE within the ITEM TEMPLATE tag (ListBox.ItemTemplate) within the "SCOPE" of the ListBox. The formatting declarations would then appear within a tag entitled <DataTemplate>. We can also define the DataTemplate within the Resources section of XAML to make it a reusable object. The DT defines HOW DATA APPEARS including appropriate bindings for textual information, borders etc.
Silverlight's DataGrid Class - The Third Incarnation of DataGrid
The DataGrid, like Microsoft's data APIs, is in a state of constant evolution. "Nous avons vu" le DataGrid of WinForms fame, followed by DataGridView (recall for one moment the software built in those paradigms), and now behold the DataGrid of Silverlight and WPF (formerly from WPFToolkit.dll). It is also known (via it's fully qualified namespace admonition) as System.Windows.Controls.DataGrid. It's XAML opening tag is <sdk:DataGrid>. Come, let us learn to think in DataGrid (la nouvelle DataGrid rather than Winforms DataGrid of yore)!
Let us begin with an elementary question. How doth one define the columns of la nouvelle DataGrid? Answer: via DataGridTextColumn, or via DataGridTemplateColumn.
To understand the latter, one must know about DATA TEMPLATING (fundamental WPF concept - so fundamental one cannot claim to be a WPF master-programmer without a detailed knowledge of the same, much like the mega-foundational concept of DEPENDENCY PROPERTIES. We will repeat now the WPF mantras once more for consolidation: DATA TEMPLATING. DEPENDENCY PROPERTIES. YEAH. Such great concepts.
Formatting tricks such as alternating row backgrounds, ability to show and hide grid-lines and scroll bars are all part of the standard DataGrid "bag of tricks". Let the GUI be with you. Always.
Let us begin with an elementary question. How doth one define the columns of la nouvelle DataGrid? Answer: via DataGridTextColumn, or via DataGridTemplateColumn.
To understand the latter, one must know about DATA TEMPLATING (fundamental WPF concept - so fundamental one cannot claim to be a WPF master-programmer without a detailed knowledge of the same, much like the mega-foundational concept of DEPENDENCY PROPERTIES. We will repeat now the WPF mantras once more for consolidation: DATA TEMPLATING. DEPENDENCY PROPERTIES. YEAH. Such great concepts.
Formatting tricks such as alternating row backgrounds, ability to show and hide grid-lines and scroll bars are all part of the standard DataGrid "bag of tricks". Let the GUI be with you. Always.
Friday, 24 December 2010
DataTemplates in Silverlight
DataTemplates specifies visualisation of data objects. Some functionality of this was lost in Silverlight 4.
Subscribe to:
Posts (Atom)