Changes

XAML

1,671 bytes added, 10:51, 29 November 2023
/* Properties */
== Properties ==
{{Hint|The previously listed available properties for binding is removed from here. Since it's more accurate and up-to-date to use the [[Developer Mode]] to inspect them in your version of the clients.}}
 
=== Accessing PropertyViewModel ===
Dealing with properties is very common. For example, you might need to display all properties of an object. Or you might want to execute a certain 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 be self-explanatory).
 
From any of these collections, you can also access a specific instance by its property name using bindings such as the following (assuming the binding context is a ContentViewModel).
 
<code>{Binding Properties.AllItems[PROPERTY_NAME]}</code>
{{Attention|While this works fine and grants you access to the correct instance of PropertyViewModel, it loads all instances for the context object even though only one (PROPERTY_NAME) is requested. So there might be an unnecessary performance lost. If accessing only single instances is needed, the newer collection [[XAML#ContentViewModel.PropertyByName|PropertyByName]] should be preferred.}}
 
==== ContentViewModel.PropertyByName {{Version/WinXSince|4.6}}{{Version/XamarinSince|4.6}} ====
This collection can also be used to access single PropertyViewModel instances using bindings such as the following (assuming the binding context is a ContentViewModel).
 
<code>{Binding PropertyByName[PROPERTY_NAME]}</code>
 
{{Attention|Unlike [[XAML#ContentViewModel.Properties.XXXItems|Properties.XXXItems]], this collection loads only the requested instance(s) and should offer better performance.}}
=== Editing Properties ===