You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Documentation/topics/bars/configuration.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -12,19 +12,19 @@ All of the Bars controls have been built from the ground up to support both XAML
12
12
13
13
## XAML Configuration
14
14
15
-
All Bars controls can be defined directly in XAML and are designed to support common WPF usage scenarios like data binding.
15
+
All Bars controls can be defined directly in XAML and are designed to support common usage scenarios like data binding.
16
16
17
17
### Pros
18
18
19
-
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.
19
+
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.
20
20
21
21
### Cons
22
22
23
23
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.
24
24
25
25
## MVVM Configuration
26
26
27
-
MVVM is an extremely popular pattern used for WPF and one that is fully supported by Bars controls.
27
+
MVVM is an extremely popular pattern used for @@PlatformTitle and one that is fully supported by Bars controls.
28
28
29
29
### Pros
30
30
@@ -39,7 +39,7 @@ In general, the MVVM pattern also has its own inherent benefits, like unit testi
39
39
40
40
### Cons
41
41
42
-
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.
42
+
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.
43
43
44
44
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.
Copy file name to clipboardExpand all lines: Documentation/topics/bars/controls/auto-generation.md
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@ order: 210
7
7
8
8
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.
9
9
10
+
@if (wpf) {
10
11
Other contextual values (like certain `ICommand` types) can also be used when auto-generating property values.
12
+
}
11
13
12
14
This time-saving feature helps reduce the need to specify many `Label` and `KeyTipText` values, except in scenarios where a customized value is necessary!
13
15
@@ -48,13 +50,17 @@ Exception for the first word in "camelCase", all recognized words will use the c
48
50
49
51
### Label from Command
50
52
53
+
@if (avalonia) {
54
+
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.
55
+
}
56
+
@if (wpf) {
51
57
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.
52
58
- The `ApplicationCommands.NotACommand` command is ignored and will always return a value of `null`.
53
59
- Any other `RoutedUICommand` will use the `RoutedUICommand.Text` property as the label.
54
60
- Any `RoutedCommand` will use the `RoutedCommand.Name` property as the label.
55
61
56
-
57
62
A value of `null` will be returned if a label could not be determined from the command.
63
+
}
58
64
59
65
## Key Tip Generation
60
66
@@ -87,11 +93,16 @@ A value of `null` will be returned if a value for key tip text could not be dete
87
93
88
94
### Key Tip from Command
89
95
96
+
@if (avalonia) {
97
+
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.
98
+
}
99
+
@if (wpf) {
90
100
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.
91
101
92
102
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.
93
103
94
104
A value of `null` will be returned if a value for key tip text could not be determined from the `ICommand`.
105
+
}
95
106
96
107
## Localization
97
108
@@ -105,7 +116,7 @@ The following steps can be used to implement localized label generation:
105
116
106
117
1. Create a new class that derives from [LabelGenerator](xref:@ActiproUIRoot.Controls.Bars.LabelGenerator).
107
118
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.
108
-
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.
119
+
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. }
109
120
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.
110
121
111
122
> [!NOTE]
@@ -119,7 +130,7 @@ The following steps can be used to implement localized key tip generation:
119
130
120
131
1. Create a new class that derives from [KeyTipTextGenerator](xref:@ActiproUIRoot.Controls.Bars.KeyTipTextGenerator).
121
132
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.
122
-
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`.
133
+
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`. }
123
134
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.
0 commit comments