== Properties ==
{{Hint|The previously listed available properties for binding Working with Properties is removed from herea foundational role of the UI customizer. Since itBe aware that the term can refer to various elements of a content object's more accurate and up-to-date to use datamodel, including details like its Title, SubTitle, UID, classification info, etc. However, this article deals specifically with '''content properties'''; those which are displayed under the [[Developer Mode]] to inspect them Property tab in your version of the clientsUBIK client.}}
=== Accessing PropertyViewModel Displaying Properties ===Dealing Displaying with properties is very an extremely commonrequirement in custom UIs. For exampleUBIK offers several different bindings, each with specific benefits. It may be enough to simply display the value of a simple string or numeric property somewhere in your UI, or else you might need to display all complex properties of an object. Or you might want to or execute a certain property-based command for one specific property. To do any of these, you first need to get access to the PropertyViewModel instance(s).
==== ContentViewModel.Properties.XXXItems ====There are multiple collections accessible this way. E.g., ContentViewModel.Properties.AllItems, ContentViewModel.Properties.VisibleItems (their names should The table below clarifies the various functionalities and how they can best be self-explanatory)used in different scenarios.
From any of It is important to note that for these collections, you can also access a specific instance by its property name using bindings such as the following (we are assuming the binding context is a ContentViewModelcontent viewmodel (ie. an object observed in the client, either after navigating to it, or else when viewing it as an item in the child list of another content object).
<code>{Binding Properties.AllItems[PROPERTY_NAME]}</code>| class="wikitable"! Collection !! {{AttentionTooltip|While Performance|Could rendering be slowed down by using this works fine and grants you access to the correct instance of PropertyViewModelbinding, it loads all instances for especially on ItemTemplates used in a list of many items.}} !! {{Tooltip|Capability|Extent of the context object even though only one viewmodel accessed}} !! {{Tooltip|Lazy-Loaded|Loaded on-demand (PROPERTY_NAME) is requestedvs. So there might be an unnecessary performance lost. If accessing always present)}} |-| Values || Great || Very limited - Read only single instances is needed, the newer collection [[XAML#ContentViewModel.PropertyByNameProperty value only || No|-| PropertyItems || Good || Limited - Read only || No|-|PropertyByName]] should be preferred|| Ok up to 5 uses || Unlimited - Full PropertyViewModel || Yes|-| Properties.}XItems || Impacted || Unlimited - Full PropertyViewModel || Yes|-|}
==== ContentViewModel* '''Values[MP_PROPERTY]''' is the most basic and performant way to bind to a property value.PropertyByName {{Version/WinXSince|4This collection simply displays the 'true' value of a property, meaning that it is only useful displaying for simple values, such as String, Int, Dbl, unformatted DateTime, etc.6}}{{Version/XamarinSince|4Properties that have a DisplayValue that is different from their true value, such as GUIDs or selective list items with labels are not best displayed using this binding, however, it can be still be used in the xaml for non-display purposes, and in combination with converters or commands. It is immediately present on the most basic content viewmodel (the ContentListItemViewModels used by child lists) without having to be loaded, and remains the best choice in most cases.6}} ====* '''PropertyItems[MP_PROPERTY]...''' can be used when the Value collection does not suffice for displaying appropriate values. This PropertyViewModel presents more options than the simple Values collection can also , however, <u>it should still only be used for displaying text in the UI</u> as it bypasses the modern functionality offered by UBIK, such as user rights, locked states, etc.* The '''Properties.XItems[MP_PROPERTY]...''' collections were created as a response to access single 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 using bindings 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 following 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 (assuming 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 context 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 ContentViewModel)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 PropertyByNameCollection[PROPERTY_NAME].'''DisplayValue'''}</code> {{Attention|Unlike , however, the capability of these viewmodels goes far beyond the DisplayValue. Use [[XAML#ContentViewModel.Properties.XXXItems|Properties.XXXItemsDeveloper_Mode]], this collection loads only the requested instance(s) and should offer better performanceto learn more.}}
=== Editing Properties ===
* The [[XAML_Tips#SetPropertyValueCommand|Set Property Value Command]] sets a named property to a specific or calculated (such as through an [[EvalExpression]]) value.
[[Category:WinX|XAML]][[Category:XAML|XAML]]
== Commands ==