Difference between revisions of "Active List Client"
(→XAML) |
|||
| Line 20: | Line 20: | ||
To enable access to an ActiveList from XAML, a new property named SelectiveItems was added to the PropertyViewModel. This property returns the ActiveList if one is configured on the content object; otherwise, it falls back to the SelectiveList defined on the MetaProperty if no ActiveList is available for the content object. Below is an example of how this can be implemented in XAML. For the SelectedItem, it is important to use the PropertyValueToSelectiveItem converter and pass the control’s own ItemsSource path as the ConverterParameter, so that the list can be provided to the converter. This means that no DataTriggers or similar mechanisms are required to switch between ActiveLists and MetaProperty SelectiveLists or to perform any checks. | To enable access to an ActiveList from XAML, a new property named SelectiveItems was added to the PropertyViewModel. This property returns the ActiveList if one is configured on the content object; otherwise, it falls back to the SelectiveList defined on the MetaProperty if no ActiveList is available for the content object. Below is an example of how this can be implemented in XAML. For the SelectedItem, it is important to use the PropertyValueToSelectiveItem converter and pass the control’s own ItemsSource path as the ConverterParameter, so that the list can be provided to the converter. This means that no DataTriggers or similar mechanisms are required to switch between ActiveLists and MetaProperty SelectiveLists or to perform any checks. | ||
| − | < | + | <tabs> |
| + | <tab name="MAUI"> | ||
| + | <source lang = "xml"> | ||
<controls:SfListViewExt | <controls:SfListViewExt | ||
x:Name="SelectiveList" | x:Name="SelectiveList" | ||
| Line 31: | Line 33: | ||
SelectionMode="Single" | SelectionMode="Single" | ||
Style="{DynamicResource UBIKListView}" /> | Style="{DynamicResource UBIKListView}" /> | ||
| − | </ | + | </source> |
| + | </tab> | ||
| + | <tab name="UWP"> | ||
| + | <source lang = "xml"> | ||
| + | <controls:ComboBoxExt | ||
| + | x:Name="ComboBox" | ||
| + | Grid.ColumnSpan="2" | ||
| + | HorizontalAlignment="Stretch" | ||
| + | DisplayMemberPath="DisplayText" | ||
| + | ItemsSource="{Binding PropertyViewModel.SelectiveItems}" | ||
| + | PlaceholderText="{Binding PropertyEdit_PickerPlaceholder, Source={StaticResource AppResources}}" | ||
| + | SelectedValue="{Binding PropertyValue, Mode=TwoWay}" | ||
| + | SelectedValuePath="Value" | ||
| + | Visibility="{Binding PropertyViewModel.ShowComboBox, Converter={StaticResource BoolToVisConverter}}" /> | ||
| + | </source> | ||
| + | </tab> | ||
| + | </tabs> | ||
{{UnderConstructionEnd}} | {{UnderConstructionEnd}} | ||
Revision as of 07:10, 20 April 2026
Introduction
When an integer MetaProperty has an ActiveList defined, the property is displayed using the existing icon (the same icon applied to properties with a SelectiveList), followed by the property's display string and the label of the currently selected list item in a closed drop-down component. The ActiveList is returned if one is available (i.e., if it has been configured on the server for the content object) and always takes precedence over a MetaProperty SelectiveList .
For editing, it behaves exactly the same as with a standard SelectiveList. The client uses a dropdown menu UI component and the dropdown menu allows the user to select exactly one value from the Active List.
When the user opens the dropdown:
- All available options from the ActiveList are displayed as text labels.
- The label for each option is shown in the language configured on the web service. If a translation for the configured language is unavailable, the label is displayed in the default language.
- Each option in the ActiveList has an associated unique integer value that is set to the MetaProperty when selected.
- Only one option can be selected at a time. Selecting an option updates the MetaProperty value immediately.
Sorting of items in the dropdown:
- If all options in the ActiveList have unique sort order values, they are displayed in ascending order of these sort order values.
- If sort orders are not unique, options with the same sort order are sorted in ascending order by their label.
XAML
To enable access to an ActiveList from XAML, a new property named SelectiveItems was added to the PropertyViewModel. This property returns the ActiveList if one is configured on the content object; otherwise, it falls back to the SelectiveList defined on the MetaProperty if no ActiveList is available for the content object. Below is an example of how this can be implemented in XAML. For the SelectedItem, it is important to use the PropertyValueToSelectiveItem converter and pass the control’s own ItemsSource path as the ConverterParameter, so that the list can be provided to the converter. This means that no DataTriggers or similar mechanisms are required to switch between ActiveLists and MetaProperty SelectiveLists or to perform any checks.
MAUI
x:Name="SelectiveList"
BindingContext="{TemplateBinding BindingContext}"
ItemSize="40"
ItemTemplate="{StaticResource PopupSelectiveListItemTemplate}"
ItemsSource="{Binding SelectiveItems}"
SelectedItem="{Binding ValueItem.PropertyValue, Mode=OneWay, Converter={StaticResource PropertyValueToSelectiveItem}, ConverterParameter={Binding Source={x:Reference SelectiveList}, Path=ItemsSource}}"
SelectionBackground="{DynamicResource UBIKAccentColor}"
SelectionMode="Single"
Style="{DynamicResource UBIKListView}" />
UWP
x:Name="ComboBox"
Grid.ColumnSpan="2"
HorizontalAlignment="Stretch"
DisplayMemberPath="DisplayText"
ItemsSource="{Binding PropertyViewModel.SelectiveItems}"
PlaceholderText="{Binding PropertyEdit_PickerPlaceholder, Source={StaticResource AppResources}}"
SelectedValue="{Binding PropertyValue, Mode=TwoWay}"
SelectedValuePath="Value"
Visibility="{Binding PropertyViewModel.ShowComboBox, Converter={StaticResource BoolToVisConverter}}" />
