-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example.xaml
46 lines (46 loc) · 2.86 KB
/
Example.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<Window x:Class="RTB.Example"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:behaviours="clr-namespace:RTB.Behaviours"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
mc:Ignorable="d"
Title="RTB" Height="200" Width="700">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<RichTextBox Grid.Column="0" FontSize="18">
<i:Interaction.Behaviors>
<behaviours:RichTextBoxRegexMatchBehaviour RegexPattern="\{[A-Za-z0-9_-]+\}">
<behaviours:RichTextBoxRegexMatchBehaviour.PropertyValues>
<x:Array Type="{x:Type behaviours:PropertyValue}">
<x:Array.Items>
<behaviours:PropertyValue Property="{x:Static TextElement.BackgroundProperty}" Value="{x:Static Brushes.MidnightBlue}" />
<behaviours:PropertyValue Property="{x:Static TextElement.ForegroundProperty}" Value="{x:Static Brushes.White}" />
<behaviours:PropertyValue Property="{x:Static TextElement.FontWeightProperty}" Value="{x:Static FontWeights.Bold}" />
</x:Array.Items>
</x:Array>
</behaviours:RichTextBoxRegexMatchBehaviour.PropertyValues>
</behaviours:RichTextBoxRegexMatchBehaviour>
</i:Interaction.Behaviors>
</RichTextBox>
<RichTextBox Grid.Column="1" FontSize="18">
<i:Interaction.Behaviors>
<behaviours:RichTextBoxRegexMatchBehaviour RegexPattern="£[0-9]\.[0-9]{2}" TextChangedDelay="500">
<behaviours:RichTextBoxRegexMatchBehaviour.PropertyValues>
<x:Array Type="{x:Type behaviours:PropertyValue}">
<x:Array.Items>
<behaviours:PropertyValue Property="{x:Static TextElement.BackgroundProperty}" Value="{x:Static Brushes.Maroon}" />
<behaviours:PropertyValue Property="{x:Static TextElement.ForegroundProperty}" Value="{x:Static Brushes.White}" />
<behaviours:PropertyValue Property="{x:Static TextElement.FontStyleProperty}" Value="{x:Static FontStyles.Italic}" />
</x:Array.Items>
</x:Array>
</behaviours:RichTextBoxRegexMatchBehaviour.PropertyValues>
</behaviours:RichTextBoxRegexMatchBehaviour>
</i:Interaction.Behaviors>
</RichTextBox>
</Grid>
</Window>