Table des matières
Les éléments d’interface (les contrôles) peuvent être modifiés en chageant les couleurs gérées directement – la couleur du motif (ThemeColor) et la couleur d’arrière-plan (ThemeBackground), dans le panneau Configuration d’interface, globalement, tous les contrôles à la fois, dans le panneau Éléments globaux ou localement, indépendamment par vue, dans le panneau Gestion des vues. La modification d’un n’importe quel paramètre de contrôle localement a une priorité plus haute qu’une modification globale.
Layout.Id
Le fonctionnement de la gestion des vues dépend de quelques facteurs. Le premier est d’enregistrer correctement la vue (utilisation de la méthode RegisterViews de la classe ModuleBase) et de créer un view-model approprié pour le mode design (DesignViewModel), le deuxième est de marquer les contrôles avec un attribut approprié.
Cet attribut est Layout.Id qui doit être unique dans l’ensemble de l’application POS. C’est une condition indispensable pour que le contrôle soit géré indépendamment. Si plusieurs contrôles ont le même Id, alors la modification d’une propriété entraînera la modification des autres contrôles.
Définir les valeurs par défaut des propriétés gérables
Les valeurs par défaut des contrôles peuvent être définies de plusieurs façons, en fonction des besoins.
1. Directement comme les attributs du contrôle défini dans xaml
<TextBlock Foreground="Red"/>
Il ne sera pas possible de gérer le contrôle ci-dessus, car l’attribut Layout.Id n’a pas été défini pour lui.
Cette méthode peut être également utilisée avec les Schémas de couleur et police :
<TextBlock Foreground="{DynamicResource ThemeColor}"/>
Le contrôle sera géré uniquement en modifiant le motif (la couleur de la police sera modifiée).
Pour qu’un contrôle soit gérable globalement dans la configuration globale d’interface, il faut l’enregistrer à l’aide de la méthode RegisterControl de la classe ModuleBase.
Pour qu’un contrôle soit gérable localement par vue où elle a été utilisée (gestion des vues), cette vue doit être enregistrée correctement (à l’aide de la méthode RegisterViews) et le contrôle doit avoir l’attribut Layout.Id. En cas d’utilisation de Layout.Id, il ne faut pas paramétrer les propriétés par défaut du contrôle directement sur lui. Si par exemple nous définissons la valeur par défaut de la propriété Foreground avant de définir Layout.Id, cette propriété sera ignorée. En revanche, si nous définissons la propriété Foreground après Layout.Id, elle ne sera pas gérable (sa valeur sera toujours remplacée par la valeur définie directement).
Une définition directe des attributs doit être effectuée uniquement pour les propriétés non-gérables comme celles qui sont indispensables au fonctionnement correct du contrôle (par exemple Binding).
2. Style global ou local de contrôle (en utilisant x:Key)
<core:View.Resources>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackground}"/>
</Style>
</core:View.Resources>
..
<TextBlock core:Layout.Id="TextBlockLayoutId" />
L’exemple ci-dessus illustre le réglage global du style de couleur de la police et de la couleur d’arrière-plan pour tous les contrôles TextBlock utilisés dans la vue <core:View> actuelle.
<core:View.Resources>
<Style x:Key="TextBlockStyle"
TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="Background" Value="{DynamicResource ThemeBackground}"/>
</Style>
</core:View.Resources>
…
<TextBlock Style="{StaticResource TextBlockStyle}" core:Layout.Id="TextBlockLayoutId" />
La modification ci-dessus présente comment définir à l’aide des styles uniquement le contrôle sélectionné.
3. Attribut par défaut défini dans ModerUI.xaml selon la définition <type_d_attribut x:Key=”[LayoutId].Default.[Nom_du_type]”>[valeur par défaut]</type_d_attribut>
Fichier ModernUI.xml
<SolidColorBrush x:Key="TextBlockLayoutId.Default.Foreground" Color="Red"/>
Fichier de vue
<TextBlock core:Layout.Id="TextBlockLayoutId" />
Pour que l’exemple ci-dessus fonctionne correctement, il est requis d’enregistrer les ressources ModernUI.xaml du module dans la classe enregistrant le module (voir le chapitre Nouveau module dans l’article Créer des vues). Dans le constructeur nous appelons :
LayoutService.RegisterResources(typeof(Module));
Les limites de cette approche lient dans l’impossibilité de définir les valeurs dynamiques et de grouper les valeurs qui se répétent sous un nom commun. Par exemple, l’utilisation suivante du code est incorrecte :
<SolidColorBrush x:Key="TextBlockLayoutId.Default.Foreground"
Color="{DynamicResource ThemeColor}"/>
Dans ce cas le type Color (System.Windows.Media.Color) et ThemeColor(SolidColorBrush) ne correspondent pas !
Il n’est pas recommandé d’utiliser cette méthode. Une exception est la définition des paramètres par défaut des colonnes de DataGrid.
Liste des propriétés prises en charge
Les tableaux ci-dessous contiennent un catalogue des propriétés qui sont gérées dans le panneau de configuration d’interface pour les contrôles individuels disponibles dans POS.
| Propriété | Nom |
| Propriété prise en charge [nom:type] | Nom dans le panneau de gestion |
Framework Element
System.Windows.FrameworkElement
| Propriété | Nom |
| Width : double | Largeur |
| Height : double | Hauteur |
| Margin : Thickness | Marge |
| HorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| VerticalAlignment : VerticalAlignment | Alignement vertical |
| MaxWidth : double | Largeur maximale |
| MaxHeight : double | Hauteur maximale |
| Grid.Position : string | Emplacement |
Control
System.Windows.Controls.Control
| Propriété | Nom |
| Background : Brush | Arrière-plan |
| Foreground : Brush | Couleur du texte |
| FontSize : double | Taille de la police |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
| Padding : Thickness | Remplissage |
| Grid.Position : string | Emplacement |
Grid
System.Windows.Controls.Grid
| Propriété | Nom |
| Background : Brush | Arrière-plan |
| Margin : Thickness | Marge |
| Visibility: Visibility | Visibilité |
| Width : double | Largeur |
| Height : double | Hauteur |
| Grid.Position : string | Position |
Comarch.POS.Presentation.Core.Controls.Grid
: System.Windows.Controls.Grid
| Propriété | Nom |
| ColumnDefinition : string | Colonnes |
| RowDefinition : string | Lignes |
Border
System.Windows.Controls.Border
| Propriété | Nom |
| Visibility : Visibility | Visibilité |
| Background : Brush | Arrière-plan |
ScrollViewer
System.Windows.Controls.ScrollViewer
: System.Windows.Controls.Control
| Propriété | Nom |
| VerticalScrollBarVisibility : ScrollBarVisibility | Barre de défilement vertical |
| HorizontalSchrollBarVisibility : ScrollBarVisibility | Barre de défilement horizontal |
| Width: double | Largeur |
| Height : double | Hauteur |
Comarch.POS.Presentation.Core.Controls.ScrollViewer
: System.Windows.Controls.ScrollViewer
| Propriété | Nom |
Separator
System.Windows.Controls.Separator
: System.Windows.FrameworkElement
| Propriété | Nom |
| Background : Brush | Arrière-plan |
TextBlock
System.Windows.Controls.TextBlock
: System.Windows.FrameworkElement
| Propriété | Nom |
| Background : Brush | Arrière-plan |
| Foreground : Brush | Couleur du texte |
| FontSize : double | Taille de la police |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
| Padding : Thickness | Remplissage |
| TextAlignment : TextAlignment | Alignement du texte |
| Visibility : Visibility | Visibilité |
| TextWrapping : TextWrapping | Renvoi à la ligne |
DoubleColorTextBlock
Comarch.POS.Presentation.Core.Controls.DoubleColorTextBlock
: System.Windows.FrameworkElement
| Propriété | Nom |
| FirstForeground : Brush | Couleur du texte 1 |
| SecondForeground : Brush | Couleur du texte 2 |
| Background : Brush | Arrière-plan |
| FontSize : double | Taille de la police |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
| Padding : Thickness | Remplissage |
| Visibility : Visibility | Visibilité |
ErrorTextBlock
Comarch.POS.Presentation.Core.Controls.ErrorTextBlock
: System.Windows.Controls.TextBlock
| Propriété | Nom |
TextBox
Comarch.WPF.Controls.TextBox
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
| BorderThickness : Thickness | Encadrement |
| BorderBrush : Brush | Couleur de l’encadrement |
| FocusedBorderBrush : Brush | Couleur de l’encadrement (focus) |
| ErrorColor : Brush | Couleur d’erreur |
| HintForeground : Brush | Couleur d’indice |
| Hint: string | Indice |
Comarch.POS.Presentation.Core.Controls.TextBox
: Comarch.WPF.Controls.TextBox
| Propriété | Nom |
Underline
Comarch.WPF.Controls.Underline
: System.Windows.FrameworkElement
| Propriété | Nom |
| Stroke : Brush | Couleur |
| StrokeThickness : Thickness | Épaisseur |
Comarch.POS.Presentation.Core.Controls.Underline
: Comarch.WPF.Controls.Underline
| Propriété | Nom |
ColumnDefinition
System.Windows.Controls.ColumnDefinition
| Propriété | Nom |
| Width : double | Largeur |
RowDefinition
System.Windows.Controls.RowDefinition
| Propriété | Nom |
| Height : double | Hauteur |
DataGridColumn
System.Windows.Controls.DataGridColumn
| Propriété | Nom |
| MaxWidth : double | Largeur maximale |
| MinWidth : double | Hauteur maximale |
| Width : DataGridLength | Largeur |
| SortDirection : ListSortDirection | Trier |
| Visibility : Visibility | Visibilité |
| HorizontalAlignment : HorizontalAlignment | Alignement horizontal |
DataGridTemplateColumn
System.Windows.Controls.DataGridTemplateColumn
: System.Windows.Controls.DataGridColumn
| Propriété | Nom |
DataGridTextColumn
System.Windows.Controls.DataGridTextColumn
: System.Windows.Controls.DataGridColumn
| Propriété | Nom |
| FontSize : double | Taille de la police |
| Foreground : Brush | Couleur du texte |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
DataGridCell
System.Windows.Controls.DataGridCell
| Propriété | Nom |
| Margin : Thickness | Marge |
| HorizontalAlignment : HorizontalAlignment | Alignement horizontal |
DataGridColumnHeader
System.Windows.Controls.Primitives.DataGridColumnHeader
| Propriété | Nom |
| Margin : Thickness | Marge |
| HorizontalContentAlignment : HorizontalAlignment | Alignement horizontal du contenu |
DataGrid
Comarch.WPF.Controls.DataGrid
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
Comarch.POS.Presentation.Core.Controls.DataGrid
| Propriété | Nom |
| RowBackground : Brush | Arrière-plan de ligne |
| HeaderBackground : Brush | Arrière-plan de l’en-tête |
| ScrollBarWidth : double | Largeur de la barre de défilement |
| VerticalScrollBarVisibility : Visibility | Barre de défilement vertical |
| HorizontalScrollBarVisibility : Visibility | Barre de défilement horizontal |
| GroupBy : DataGridGroup | Trier par |
| IsVirtualizingWhenGrouping : bool | Virtualiser lignes |
| ScrollUnit : ScrollUnit | Unité de glissière |
| Grid.Position : string | Position |
ItemsContainer
Comarch.POS.Presentation.Core.Controls.ItemsContainer
: System.Windows.FrameworkElement
| Propriété | Nom |
| Orientation : Orientation | Orientation |
| Padding : Thickness | Remplissage |
| Background : Brush | Arrière-plan |
| MoreMultiButtonHeight : double | Hauteur |
| MoreMultiButtonWidth : double | Largeur |
| MoreMultiButtonImageHeight : double | Hauteur d’icône |
| MoreMultiButtonImageWidth : double | Largeur d’icône |
| MoreMultiButtonMargin : Thickness | Marge |
| MoreMultiButtonImageMargin : Thickness | Marge d’icône |
| MoreMultiButtonFontSize : double | Taille de la police |
| MoreMultiButtonIsImageVisible : bool | Afficher icône |
Expander
Comarch.POS.Presentation.Core.Controls.Expander
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
| HeaderBackground : Brush | Arrière-plan de l’en-tête |
| HeaderPadding : Thickness | Remplissage de l’en-tête |
Image
System.Windows.Controls.Image
: System.Windows.FrameworkElement
| Propriété | Nom |
| Stretch : Stretch | Étendre |
| StretchDirection : StretchDirection | Sens d’étirement |
Comarch.WPF.Controls.Image
| Propriété | Nom |
| HorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| HorizontalContentAlignment : HorizontalAlignment | Alignement horizontal du contenu |
| VerticalAlignment : VerticalAlignment | Alignement vertical |
| VerticalContentAlignment : VerticalAlignment | Alignement vertical du contenu |
Comarch.POS.Presentation.Core.Controls.Image
: System.Windows.FrameworkElement
| Propriété | Nom |
| DefaultImageKey : ImageKey | Icône par défaut |
BundleImage
Comarch.POS.Presentation.Core.Controls.BundleImage
| Propriété | Nom |
| IconForeground : Brush | Couleur |
| IconMargin : Thickness | Marge |
| IconImageKey : ImageKey | Icône |
| Width : double | Largeur |
| Height : double | Hauteur |
| PopupMaxWidth : double | Hauteur maximale |
| PopupMinWidth : double | Hauteur minimale |
Button
Comarch.POS.Presentation.Core.Controls.Button
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
Autres sur la base de Button, par exemple :
Comarch.POS.Presentation.Core.Controls.AcceptButton
Comarch.POS.Presentation.Core.Controls.CancelButton
Comarch.POS.Presentation.Core.Controls.SelectButton
Comarch.POS.Presentation.Core.Controls.CleanButton
Comarch.POS.Presentation.Core.Controls.TileButton
Comarch.POS.Presentation.Core.Controls.PaymentTypeTile
Comarch.POS.Presentation.Core.Controls.PrintLabelButton
Comarch.POS.Presentation.Core.Controls. ShowItemsVariantsButton
| Propriété | Nom |
| ImageKey : ImageKey | Icône |
| ImageMargin : Thickness | Marge d’icône |
| ImageWidth : double | Largeur d’icône |
| ImageHeight : double | Hauteur d’icône |
| ImageHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ImageVerticalAlignment : VerticalAlignment | Alignement vertical |
| IsImageVisible : bool | Afficher l’icône |
| ShortcutMargin : Thickness | Marge |
| ShortcutWidth : double | Largeur |
| ShortcutHeight : double | Hauteur |
| ShortcutHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ShortcutVerticalAlignment : VerticalAlignment | Alignement vertical |
| IsShortcutVisible : bool | Afficher le raccourci |
| Shortcut : Shortcut | Raccourci clavier |
| IsScaledShortcut : bool | Mise à l’échelle du contenu |
| ContentMargin : Thickness | Marge |
| ContentWidth : double | Largeur |
| ContentHeight : double | Hauteur |
| ContentHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ContentVerticalAlignment : VerticalAligment | Alignement vertical |
| ContentVisibility : Visibility | Visibilité |
| IsScaledContent : bool | Mise à l’échelle du contenu |
| Orientation : Orientation | Orientation |
| ItemsContainer.NoWrapButton : bool | Ne pas agréger |
RadioButton
Comarch.POS.Presentation.Core.Controls.RadioButton
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
| CheckedStateBackground : Brush | Arrière-plan d’élément sélectionné |
| CheckedStateForeground : Brush | Texte d’élément sélectionné |
| ImageKey : ImageKey | Icône |
| ImageMargin : Thickness | Marge d’icône |
| ImageWidth : double | Largeur d’icône |
| ImageHeight : double | Hauteur d’icône |
| ImageHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ImageVerticalAlignment : VerticalAlignment | Alignement vertical |
| IsImageVisible : Visibility | Afficher l’icône |
| ContentMargin : Thickness | Marge |
| ContentWidth : double | Largeur |
| ContentHeight : double | Hauteur |
| ContentHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ContentVerticalAlignment : VerticalAlignment | Alignement vertical |
| ContentVisibility : Visibility | Visibilité |
| IsScaledContent : bool | Mise à l’échelle du contenu |
| Orientation : Orientation | Orientation |
FieldControl
Comarch.POS.Presentation.Core.Controls.FieldControl
: System.Windows.FrameworkElement
| Propriété | Nom |
| Orientation : Orientation | Orientation |
| LabelMargin : Thickness | Marge |
| LabelWidth : double | Largeur |
| LabelHeight : double | Hauteur |
| LabelFontSize : double | Taille de la police |
| LabelFontStyle : FontStyle | Style de la police |
| LabelFontWeight : FontWeight | Poids de la police |
| LabelForeground : Brush | Couleur du texte |
| LabelForegroundError : Brush | Couleur en absence de validation |
| LabelHorizontalAlignment: HorizontalAlignment | Alignement horizontal |
| LabelVertivalAlignment: VerticalAlignment | Alignement vertical |
| ContentIsRequired : bool | Requis |
CheckBox
Comarch.POS.Presentation.Core.Controls.CheckBox
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
| CheckedStateBackground : Brush | Arrière-plan d’élément sélectionné |
| CheckedStateForeground : Brush | Texte d’élément sélectionné |
| DisabledStateBackground : Brush | Arrière-plan d’élément inactif |
| DisabledCheckedStateBackground : Brush | Arrière-plan d’élément inactif sélectionné |
| ImageKey : ImageKey | Icône |
| ImageMargin : Thickness | Marge d’icône |
| ImageWidth : double | Largeur d’icône |
| ImageHeight : double | Hauteur d’icône |
| ImageHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ImageVerticalAlignment : VerticalAlignment | Alignement vertical |
| IsImageVisible : Visibility | Afficher l’icône |
| ContentMargin : Thickness | Marge |
| ContentWidth : double | Largeur |
| ContentHeight : double | Hauteur |
| ContentHorizontalAlignment : HorizontalAlignment | Alignement horizontal |
| ContentVerticalAlignment : VerticalAlignment | Alignement vertical |
| ContentVisibility : Visibility | Visibilité |
| IsScaledContent : bool | Mise à l’échelle du contenu |
| Orientation : Orientation | Orientation |
ComboBox
Comarch.WPF.Controls.ComboBox
: System.Windows.FrameworkElement,
System.Windows.Controls.Control
| Propriété | Nom |
| HorizontalContentAlignment : HorizontalAlignment | Alignement horizontal du contenu |
| PopupBackground : Brush | Arrière-plan |
| FocusedBorderBrush : Brush | Couleur de l’encadrement (focus) |
| ErrorColor : Brush | Couleur d’erreur |
Comarch.POS.Presentation.Core.Controls.ComboBox
: Comarch.WPF.Controls.TextBox
| Propriété | Nom |
ComboBox2
Comarch.POS.Presentation.Core.Controls. ComboBox2
| Propriété | Nom |
| LabelFontSize : double | Taille de la police |
| LabelFontStyle : FontStyle | Style de la police |
| LabelFontWeight : FontWeight | Poids de la police |
| Shortcut : Shortcut | Raccourci clavier |
| FontSize : double | Taille de la police |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
| Visibility : Visibility | Visibilité |
AutoCompleteComboBox
Comarch.POS.Presentation.Core.Controls.AutoCompleteComboBox
: System.Windows.Controls.Control
| Propriété | Nom |
| HintForeground : Brush | Couleur d’indice |
| Hint: string | Indice |
| FocusedBorderBrush : Brush | Couleur de l’encadrement (focus) |
| ErrorColor : Brush | Couleur d’erreur |
SwitchBox
Comarch.POS.Presentation.Core.Controls.SwitchBox
: System.Windows.Controls.Control
| Propriété | Nom |
| VerticalContentAlignment : VerticalAlignment | Alignement vertical du contenu |
| Margin : Thickness | Marge |
SearchBox
Comarch.POS.Presentation.Core.Controls.SearchBox
| Propriété | Nom |
| FontSize : double | Taille de la police |
| Foreground : Brush | Arrière-plan |
| HintForeground : Brush | Couleur d’indice |
| Margin : Thickness | Marge |
| Hint: string | Indice |
DatePicker
Comarch.POS.Presentation.Core.Controls.DatePicker
: System.Windows.Controls.Control
| Propriété | Nom |
| FocusedBorderBrush : Brush | Couleur de l’encadrement (focus) |
| ErrorColor : Brush | Couleur d’erreur |
| BorderBrush : Brush | Couleur de l’encadrement |
| Visibility : Visibility | Visibilité |
ButtonSpinner
Comarch.POS.Presentation.Core.Controls.ButtonSpinner
| Propriété | Nom |
| ButtonImageWidth : double | Largeur |
| ButtonImageHeight : double | Hauteur |
| ButtonWidth : double | Largeur du bouton |
| ButtonHeight : double | Hauteur du bouton |
FilterItemsControl
Comarch.POS.Presentation.Core.Controls.FilterItemsControl
Propriété |
Nom |
| MaxFilterItemsPerRow : int | Nombre de filtres maximal |
Visibility : Visibility |
Visibilité |
Grid.Position : string |
Position |
SearchBoxFilter
Comarch.POS.Presentation.Core.Controls.SearchBoxFilter
: Comarch.POS.Presentation.Core.Controls.ComboBox2
| Propriété | Nom |
| DefaultFilter : string | Valeur de filtre par défaut |
StockTile
Comarch.POS.Presentation.Core.Controls.StockTile
| Propriété | Nom |
| Background : Brush | Arrière-plan |
| IsCodeVisible : bool | Afficher le code d’entrepôt |
| WarehouseMargin : Thickness | Marge |
| WarehouseCodeFontSize : double | Taille de la police du code |
| WarehouseNameFontSize : double | Taille de la police de la désignation |
| StocksFontSize : double | Taille de la police |
| StocksMargin : Thickness | Marge |
SetValueNumbersKeyboard
Comarch.WPF.Controls.SetValueNumbersKeyboard
| Propriété | Nom |
| Visibility : Visibility | Visibilité |
AttributeControl
Comarch.POS.Presentation.Core.Controls.AttributeControl
: System.Windows.Controls.Control
| Propriété | Nom |
AssistantControl
Comarch.POS.Presentation.Core.Controls.AssistantControl
| Propriété | Nom |
| LabelFontSize : double | Taille de la police |
| LabelFontStyle : FontStyle | Style de la police |
| LabelFontWeight : FontWeight | Poids de la police |
| FontSize : double | Taille de la police |
| FontWeight : FontWeight | Poids de la police |
| FontStyle : FontStyle | Style de la police |
| Shortcut : Shortcut | Raccourci clavier |
| Visibility : Visibility | Visibilité |
| Grid.Position : string | Position |
DocumentKeypad
Comarch.POS.Presentation.Core.Controls.DocumentKeypad
| Propriété | Nom |
| HeaderFontSize : double | |
| KeypadHeaderColor : Brush |