1using Microsoft.Maui.Controls;
2using Microsoft.Maui.Controls.Shapes;
5using Path =
Microsoft.Maui.Controls.Shapes.Path;
18 BindableProperty.Create(
28 BindableProperty.Create(
38 BindableProperty.Create(
50 BindableProperty.Create(
100 Style TransientBorderStyle =
new Style(typeof(Border))
105 new Setter { Property = BackgroundColorProperty, Value = AppColors.Purple15 },
106 new Setter { Property = Border.PaddingProperty, Value =
new Thickness(
AppStyles.SmallSpacing,
AppStyles.SmallSpacing/2) }
110 Style EncryptedBorderStyle =
new Style(typeof(Border))
115 new Setter { Property = BackgroundColorProperty, Value = AppColors.Blue20Affirm },
116 new Setter { Property = Border.PaddingProperty, Value =
new Thickness(
AppStyles.SmallSpacing,
AppStyles.SmallSpacing/2) }
120 Style TransientPathStyle =
new Style(typeof(Path))
124 new Setter { Property = Shape.FillProperty, Value = AppColors.Purple },
125 new Setter { Property = VerticalOptionsProperty, Value = LayoutOptions.Fill },
126 new Setter { Property = HorizontalOptionsProperty, Value = LayoutOptions.Fill },
127 new Setter { Property = Shape.AspectProperty, Value = Stretch.Uniform },
128 new Setter { Property = WidthRequestProperty, Value = 18 },
129 new Setter { Property = HeightRequestProperty, Value = 18 }
133 Style EncryptedPathStyle =
new Style(typeof(Path))
137 new Setter { Property = Shape.FillProperty, Value = AppColors.Blue },
138 new Setter { Property = VerticalOptionsProperty, Value = LayoutOptions.Fill },
139 new Setter { Property = HorizontalOptionsProperty, Value = LayoutOptions.Fill },
140 new Setter { Property = Shape.AspectProperty, Value = Stretch.Uniform },
141 new Setter { Property = WidthRequestProperty, Value = 18 },
142 new Setter { Property = HeightRequestProperty, Value = 18 }
146 Style TransientLabelStyle =
new Style(typeof(Label))
150 new Setter { Property = Label.TextColorProperty, Value = AppColors.Purple },
151 new Setter { Property = Label.FontSizeProperty, Value = 15 },
152 new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.WordWrap },
153 new Setter { Property = Label.VerticalTextAlignmentProperty, Value = TextAlignment.Center },
154 new Setter { Property = Label.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }
158 Style EncryptedLabelStyle =
new Style(typeof(Label))
162 new Setter { Property = Label.TextColorProperty, Value = AppColors.Blue },
163 new Setter { Property = Label.FontSizeProperty, Value = 15 },
164 new Setter { Property = Label.LineBreakModeProperty, Value = LineBreakMode.WordWrap },
165 new Setter { Property = Label.VerticalTextAlignmentProperty, Value = TextAlignment.Center },
166 new Setter { Property = Label.HorizontalTextAlignmentProperty, Value = TextAlignment.Center }
171 Grid StatusGrid =
new Grid
175 new ColumnDefinition { Width = GridLength.Auto },
176 new ColumnDefinition { Width = GridLength.Auto }
178 ColumnSpacing = AppStyles.SmallSpacing
182 Border TransientBorder =
new Border
184 Style = TransientBorderStyle
186 TransientBorder.SetBinding(IsVisibleProperty,
new Binding(nameof(this.
IsTransient), source:
this));
188 Grid TransientInnerGrid =
new Grid
192 new ColumnDefinition { Width = GridLength.Auto },
193 new ColumnDefinition { Width = GridLength.Auto }
195 ColumnSpacing = AppStyles.SmallSpacing
198 Path TransientPath =
new Path
200 Style = TransientPathStyle,
202 Data = Geometries.VisibilityOffPath
205 Label TransientLabel =
new Label
207 Style = TransientLabelStyle,
209 TransientLabel.SetBinding(Label.TextProperty,
new Binding(nameof(this.
TransientText), source:
this));
211 Grid.SetColumn(TransientPath, 0);
212 Grid.SetColumn(TransientLabel, 1);
214 TransientInnerGrid.Children.Add(TransientPath);
215 TransientInnerGrid.Children.Add(TransientLabel);
216 TransientBorder.Content = TransientInnerGrid;
219 Border EncryptedBorder =
new Border
221 Style = EncryptedBorderStyle
223 EncryptedBorder.SetBinding(IsVisibleProperty,
new Binding(nameof(this.
IsEncrypted), source:
this));
225 Grid EncryptedInnerGrid =
new Grid
229 new ColumnDefinition { Width = GridLength.Auto },
230 new ColumnDefinition { Width = GridLength.Auto }
232 ColumnSpacing = AppStyles.SmallSpacing
235 Path EncryptedPath =
new Path
237 Style = EncryptedPathStyle,
238 Data = Geometries.LockPath
241 Label EncryptedLabel =
new Label
243 Style = EncryptedLabelStyle,
245 EncryptedLabel.SetBinding(Label.TextProperty,
new Binding(nameof(this.
EncryptedText), source:
this));
247 Grid.SetColumn(EncryptedPath, 0);
248 Grid.SetColumn(EncryptedLabel, 1);
250 EncryptedInnerGrid.Children.Add(EncryptedPath);
251 EncryptedInnerGrid.Children.Add(EncryptedLabel);
252 EncryptedBorder.Content = EncryptedInnerGrid;
255 StatusGrid.Children.Add(TransientBorder);
256 StatusGrid.Children.Add(EncryptedBorder);
259 this.Content = StatusGrid;
A strongly-typed resource class, for looking up localized strings, etc.
static string Transient
Looks up a localized string similar to Transient.
static string Encrypted
Looks up a localized string similar to Encrypted.
Base class that references services in the app.
static IReportingStringLocalizer Localizer
Localization service
Static class that gives access to app-specific styles
A custom control that indicates parameter protection status using transient and encrypted indicators.
static readonly BindableProperty EncryptedTextProperty
Bindable property for the encrypted text.
bool IsTransient
Gets or sets a value indicating whether the transient status is visible.
static readonly BindableProperty TransientTextProperty
Bindable property for the transient text.
static readonly BindableProperty IsTransientProperty
Bindable property for controlling the visibility of the transient status indicator.
string? EncryptedText
Gets or sets the encrypted text.
ParameterProtectionIndicator()
Initializes a new instance of the ParameterProtectionIndicator class.
bool IsEncrypted
Gets or sets a value indicating whether the encrypted status is visible.
string? TransientText
Gets or sets the transient text.
static readonly BindableProperty IsEncryptedProperty
Bindable property for controlling the visibility of the encrypted status indicator.