Jump to: navigation, search

Changes


XAML

715 bytes added, 1 July
/* Displaying Properties */ Added troubleshooting
* The '''Properties.XItems[MP_PROPERTY]...''' collections were created as a response to the earlier collections of Values and PropertyItems not exposing enough of a content object's data to be useful to our ever more sophisticated custom UIs. These collections now provide the full PropertyViewModel, where all aspects of a property (including ''it's'' properties, such as Unit attached to Double, the seperate Min/Value/Max valueitems, Date and Time extracted from the DateTime property, Lon/Lat or Alt extracted from the Geo property, and many more) can be accessed in Bindings.
** However, the downside of accessing this huge viewmodel is the noticeable performance impact, as it loads all instances of properties for the context object, even though only one (MP_PROPERTY) is requested. This impact is felt especially when such as binding is used on an item template in a list with many content objects, of which each has many properties.
** These collections are [[Fast_Startup_(Client)|Lazy Loaded]]*, which means that they are not loaded by default, however, a single binding to that collection will load it. When used on an item template in a list, all viewmodels for all properties for all child items will simultaneously be loaded, leading to the performance impact described in this article.
** "Properties.XItems" is not a real collection. The most frequently used collections are Properties.AllItems, Properties.VisibleItems, Properties.EditableItems, and Properties.ImportantItems (properties which fall into the [[UBIK_WinX_Client_Basics#High_priority_properties|Priority threshold]]). The number of properties delivered to a content object in each collection (for example; all, 80%, 40% and 10%, respectively) is also a consideration when estimating the performance impact of binding to these collections; simply put, use the smallest collection possible where the desired property is consistently located.
* The '''PropertyByName[MP_PROPERTY]...''' collection was created to overcome the performance impact arising from using Properties.XItems, by individually loading the PropertyViewModel for the named property. However, note that the benefit only lasts while the binding is used sparingly; rendering performance will be roughly the same as loading the Properties collection after 3-5 uses on a single item template.
{{Hint|The Values[ ] collection delivers the property's value as a string. The equivalent for the other bindings (above shown as '...') is <code>{Binding Collection[PROPERTY_NAME].'''DisplayValue'''}</code>, however, the capability of these viewmodels goes far beyond the DisplayValue. Use [[Developer_Mode]] to learn more.}}  ==== * Troubleshooting null property values ====Because certain property collections are Lazy-loaded as described above, it may be the case that bindings to these properties appear null in certain circumstances, especially if the collection is loaded after the page is rendered, such as through a command or behavior. To troubleshoot this issue, you can ensure that the property collection is accessed during rendertime rather than runtime (simply put, while the page is being constructed rather than during normal use) by applying the same binding to, for example, a Label. This measure should still work if the Label is hidden from view using a visibility binding. [[Category:WinX|XAML]][[Category:XAML|XAML]]
=== Editing Properties ===
696
edits