Skip to content

Commit 109f187

Browse files
authored
Update README.md
1 parent 10cb1af commit 109f187

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ Collection of .NET libraries like utilities and controls that target .NET Standa
4848
* `TryFindVisualChildElementByName : bool`
4949
* `FindVisualChildElements<TChildren> : IEnumerable<TChildren>`
5050
* `ICollection.AddRange<TItem> : IEnumerable<TItem>`
51+
* Attached Behaviors for WPF e.g.
52+
* [`Popup`](https://github.com/BionicCode/BionicCode.Net#popup) - e.g., allows to make the `Popup` sticky and moves it with the current placement target.
53+
* [`TextControl`](https://github.com/BionicCode/BionicCode.Net#textcontrol) - Allows to highlight text ranges in `TextBlock` and `RichTextBox` controls
54+
* [`PasswordBox`](https://github.com/BionicCode/BionicCode.Net#passwordbox) - Enables to send the `PasswordBox.SecurePassword` value to the view model using a `ICommand`.
55+
* `TryFindVisualChildElementByName : bool`
56+
* `FindVisualChildElements<TChildren> : IEnumerable<TChildren>`
57+
* `ICollection.AddRange<TItem> : IEnumerable<TItem>`
5158
* EventArgs
5259
* [`ValueChangedEventArgs<T>`](https://github.com/BionicCode/BionicCode.Net#valuechangedeventargst)
5360
* [`ValueEventArgs<T>`](https://github.com/BionicCode/BionicCode.Net#valueeventargst)
@@ -173,6 +180,66 @@ List<TimeSpan> elapsedTime = Profiler.LogTimes(() => ReadFromDatabase(), 1000);
173180
TimeSpan elapsedTime = Profiler.LogTime(() => ReadFromDatabase());
174181
```
175182

183+
--------
184+
### `PasswordBox`
185+
Invokes a `ICommand` when `PasswordBox.PasswordChanged`event was raised. The password is send as `SecureString` to secure the value.
186+
187+
#### Example
188+
189+
```XAML
190+
191+
<PasswordBox PasswordBox.Command="{Binding VerifyPasswordCommand}" />
192+
193+
```
194+
----
195+
### `TextControl`
196+
Attached behavior that supports dynamic text highlighting for controls derived from `TextBlock` or `RichTextBox`.
197+
198+
#### Example
199+
200+
```XAML
201+
202+
<!-- Bind Text and HighlightRanges to a view model -->
203+
<TextBlock Text="{Binding Message}"
204+
TextControl.HighlighBackground="Orange"
205+
TextControl.HighlighForeground="White"
206+
TextControl.HighlightRanges="{Binding HighlightTextRanges}"
207+
TextControl.IsHighlighEnabled="True" />
208+
209+
210+
<!-- Alternatively define the HighlightRange items inline -->
211+
<TextBlock Text="{Binding Message}"
212+
TextControl.HighlighBackground="Orange"
213+
TextControl.HighlighForeground="White"
214+
TextControl.IsHighlighEnabled="True">
215+
<attachedBehaviors:TextControl.HighlightRanges>
216+
<attachedBehaviors:HighlightRange StartIndex="2" EndIndex="8"/>
217+
<attachedBehaviors:HighlightRange StartIndex="12" EndIndex="15"/>
218+
</attachedBehaviors:TextControl.HighlightRanges>
219+
</TextBlock>
220+
221+
<!--
222+
Use a RichTextBox and bind it to a string by binding TextControl.Text instead of RichTextBox.Document.
223+
The text will be automatically converted to a FlowDocument and assigned to RichTextBox.Document.
224+
-->
225+
<RichTextBox TextControlText="{Binding Message}"
226+
TextControl.HighlighBackground="Orange"
227+
TextControl.HighlighForeground="White"
228+
TextControl.IsHighlighEnabled="True"
229+
TextControl.HighlightRanges="{Binding HighlightTextRanges}" />
230+
```
231+
----
232+
### `Popup`
233+
Set of attached behaviors for the `System.Windows.Controls.Primitives.Popup` control.
234+
When `Popup.IsSticky` is set to `true`, the `Popup` is forced to stick to the current `Popup.PlacementTarget`. The `Popup` will follow the `Popup.PlacementTarget` whenever it changes it's screen coordinates.
235+
236+
#### Example
237+
238+
```XAML
239+
240+
<Popup Popup.IsSticky="True" />
241+
242+
```
176243
----
177244
### `ValueChangedEventArgs<T>`
178245
Generic `EventArgs` implementation that provides value change information like `OldValue` and `NewValue`.

0 commit comments

Comments
 (0)