Skip to content

Commit

Permalink
Updates for v24.1.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
billhenn committed Dec 17, 2024
1 parent d6f3ce3 commit d4c2fc1
Show file tree
Hide file tree
Showing 74 changed files with 2,456 additions and 167 deletions.
8 changes: 4 additions & 4 deletions Documentation/topics/bars/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ All of the Bars controls have been built from the ground up to support both XAML
## XAML Configuration

All Bars controls can be defined directly in XAML and are designed to support common WPF usage scenarios like data binding.
All Bars controls can be defined directly in XAML and are designed to support common usage scenarios like data binding.

### Pros

XAML is familiar to most WPF developers and popular IDEs like Visual Studio provide designers that make it easy to visualize the run-time appearance of controls as their XAML is written. Newer IDEs even support hot reload of XAML definitions to modify a control at run-time and immediately see the impact of a change. Getting started with XAML can be very quick and the entire control definition can often be contained in a single file.
XAML is familiar to most @@PlatformTitle developers and popular IDEs like Visual Studio provide designers that make it easy to visualize the run-time appearance of controls as their XAML is written. Newer IDEs even support hot reload of XAML definitions to modify a control at run-time and immediately see the impact of a change. Getting started with XAML can be very quick and the entire control definition can often be contained in a single file.

### Cons

Some controls are used in multiple locations, and using XAML will typically require controls to be redefined everywhere they are used. For instance, a button that appears on a ribbon tab, a quick access toolbar, and a context menu might have to be defined three times. Care must be taken to ensure the same `Key` value is used for each control instance and common UI-centric properties like labels, tooltips, and icons will need to be repeated and synchronized between each control instance.

## MVVM Configuration

MVVM is an extremely popular pattern used for WPF and one that is fully supported by Bars controls.
MVVM is an extremely popular pattern used for @@PlatformTitle and one that is fully supported by Bars controls.

### Pros

Expand All @@ -39,7 +39,7 @@ In general, the MVVM pattern also has its own inherent benefits, like unit testi

### Cons

The MVVM pattern is naturally more complex than working directly in XAML and involves multiple view model classes, template selectors, styles, and other classes working together to achieve the desired result. Our companion [MVVM Library](mvvm-support.md) and extensive samples can get developers moving quickly, but configuring at least one central repository of view models for controls will be necessary. Testing design changes usually requires running the application since a visual designer may not be able to support the MVVM configuration at design-time.
The MVVM pattern is naturally more complex than working directly in XAML and involves multiple view model classes, template selectors, @if (avalonia) { themes, }@if (wpf) { styles, } and other classes working together to achieve the desired result. Our companion [MVVM Library](mvvm-support.md) and extensive samples can get developers moving quickly, but configuring at least one central repository of view models for controls will be necessary. Testing design changes usually requires running the application since a visual designer may not be able to support the MVVM configuration at design-time.

Getting started with MVVM will typically take longer than XAML even if there are long-term efficiency gains. For simple projects, MVVM benefits may not be worth the extra effort.

Expand Down
17 changes: 14 additions & 3 deletions Documentation/topics/bars/controls/auto-generation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ order: 210

Many controls have `Key`, `Label`, and `KeyTipText` properties. Since these properties are closely related, controls can auto-generate a `Label` value based on the `Key` if no other `Label` has been explicitly set. Likewise, a `KeyTipText` value can be auto-generated from a `Label` if no other `KeyTipText` has been expicitly set.

@if (wpf) {
Other contextual values (like certain `ICommand` types) can also be used when auto-generating property values.
}

This time-saving feature helps reduce the need to specify many `Label` and `KeyTipText` values, except in scenarios where a customized value is necessary!

Expand Down Expand Up @@ -48,13 +50,17 @@ Exception for the first word in "camelCase", all recognized words will use the c
### Label from Command

@if (avalonia) {
The default [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator.FromCommand*) method implementation will always return `null`, but this method can be overridden by derived classes to automatically provide labels for known commands.
}
@if (wpf) {
The default [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator.FromCommand*) method implementation will analyze an `ICommand` to determine the best label.
- The `ApplicationCommands.NotACommand` command is ignored and will always return a value of `null`.
- Any other `RoutedUICommand` will use the `RoutedUICommand.Text` property as the label.
- Any `RoutedCommand` will use the `RoutedCommand.Name` property as the label.


A value of `null` will be returned if a label could not be determined from the command.
}

## Key Tip Generation

Expand Down Expand Up @@ -87,11 +93,16 @@ A value of `null` will be returned if a value for key tip text could not be dete

### Key Tip from Command

@if (avalonia) {
The default [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromCommand*) method implementation will always return `null`, but this method can be overridden by derived classes to automatically provide key tips for known commands.
}
@if (wpf) {
The default [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromCommand*) method implementation will analyze an `ICommand` to determine the best key tip text.

If the `ICommand` is a `RoutedCommand`, the `RoutedCommand.InputGestures` collection will be queried for gestures of type `KeyGesture`. The first `KeyGesture` that returns a non-`null` value when passed to [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromKeyGesture](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromKeyGesture*) will be used as the key tip text.

A value of `null` will be returned if a value for key tip text could not be determined from the `ICommand`.
}

## Localization

Expand All @@ -105,7 +116,7 @@ The following steps can be used to implement localized label generation:

1. Create a new class that derives from [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).
1. Override the [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).[FromKey](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator.FromKey*) method to return a localized label for the given key.
1. Optionally override the [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator.FromCommand*) method to return a localized label for the given command. This is only necessary if the `RoutedUICommand.Text` or `RoutedCommand.Name` properties are not already localized.
1. Optionally override the [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator.FromCommand*) method to return a localized label for the given command.@if (wpf) { This is only necessary if the `RoutedUICommand.Text` or `RoutedCommand.Name` properties are not already localized. }
1. During application startup before any UI is initialized, set the [BarControlService](xref:@ActiproUIRoot.Controls.Bars.BarControlService).[LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.BarControlService.LabelGenerator) property to an instance of the custom class.

> [!NOTE]
Expand All @@ -119,7 +130,7 @@ The following steps can be used to implement localized key tip generation:

1. Create a new class that derives from [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).
1. Override the [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromLabel](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromLabel*) method to return a localized key tip text for the given label.
1. Optionally override the [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromCommand*) method to return a localized key tip text for the given command. This is only necessary if key tip text cannot be auto-generated from a `KeyGesture` defined within `RoutedCommand.InputGestures`.
1. Optionally override the [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).[FromCommand](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator.FromCommand*) method to return a localized key tip text for the given command.@if (wpf) { This is only necessary if key tip text cannot be auto-generated from a `KeyGesture` defined within `RoutedCommand.InputGestures`. }
1. During application startup before any UI is initialized, set the [BarControlService](xref:@ActiproUIRoot.Controls.Bars.BarControlService).[KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.BarControlService.KeyTipTextGenerator) property to an instance of the custom class.

> [!NOTE]
Expand Down
Loading

0 comments on commit d4c2fc1

Please sign in to comment.