-
Notifications
You must be signed in to change notification settings - Fork 58
/
AsnHexViewer.xaml
104 lines (104 loc) · 6.36 KB
/
AsnHexViewer.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<UserControl x:Class="Asn1Editor.Wpf.Controls.AsnHexViewer"
xmlns="http:https://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http:https://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http:https://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http:https://schemas.microsoft.com/expression/blend/2008"
xmlns:ctrl="clr-namespace:SysadminsLV.WPF.OfficeTheme.Controls;assembly=Wpf.OfficeTheme"
xmlns:controls="clr-namespace:Asn1Editor.Wpf.Controls"
mc:Ignorable="d"
BorderThickness="1"
BorderBrush="#add1ff"
d:DataContext="{d:DesignInstance controls:AsnHexViewer}"
d:DesignHeight="50" d:DesignWidth="50">
<UserControl.Resources>
<Style x:Key="RtbHeaderStyle" TargetType="RichTextBox" BasedOn="{StaticResource {x:Type RichTextBox}}">
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="#D5E7FE"/>
<Setter Property="Foreground" Value="Navy"/>
<Setter Property="IsEnabled" Value="False"/>
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="ContextMenu" Value="{x:Null}"/>
<Setter Property="IsUndoEnabled" Value="False"/>
</Style>
<Style x:Key="RtbPaneStyle" TargetType="ctrl:BindableRichTextBox" BasedOn="{StaticResource {x:Type ctrl:BindableRichTextBox}}">
<Setter Property="BorderBrush" Value="{StaticResource Panel.Border.LightBrush}"/>
<Setter Property="BorderThickness" Value="0,0,1,0"/>
<Setter Property="IsReadOnly" Value="True"/>
<Setter Property="IsUndoEnabled" Value="False"/>
<Setter Property="FontFamily" Value="Consolas"/>
<Setter Property="IsReadOnlyCaretVisible" Value="True"/>
<Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
</Style>
</UserControl.Resources>
<DockPanel>
<Border DockPanel.Dock="Top" BorderThickness="1" BorderBrush="#FF6F9CD8" Height="1"/>
<Border DockPanel.Dock="Top" BorderThickness="1" BorderBrush="#F1F7FE" Height="1"/>
<Border DockPanel.Dock="Top" BorderThickness="0,0,0,1" BorderBrush="#FFACD0FE">
<DockPanel>
<RichTextBox x:Name="HexAddrHeaderRtb"
x:FieldModifier="private"
Style="{StaticResource RtbHeaderStyle}"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ShowAddressPane, Converter={StaticResource BooleanToVisibility}}">
<RichTextBox.Document>
<FlowDocument>
<Paragraph>
<Run Text=" Addr" FontWeight="Bold"/>
</Paragraph>
</FlowDocument>
</RichTextBox.Document>
</RichTextBox>
<RichTextBox x:Name="HexRawHeaderRtb"
x:FieldModifier="private"
Style="{StaticResource RtbHeaderStyle}">
<RichTextBox.Document>
<FlowDocument>
<Paragraph>
<Run Text="00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F" FontWeight="Bold"/>
</Paragraph>
</FlowDocument>
</RichTextBox.Document>
</RichTextBox>
<RichTextBox x:Name="HexAsciiHeaderRtb"
x:FieldModifier="private"
Style="{StaticResource RtbHeaderStyle}"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ShowAsciiPane, Converter={StaticResource BooleanToVisibility}}">
<RichTextBox.Document>
<FlowDocument>
<Paragraph>
<Run Text=" ASCII" FontWeight="Bold"/>
</Paragraph>
</FlowDocument>
</RichTextBox.Document>
</RichTextBox>
</DockPanel>
</Border>
<DockPanel>
<ScrollBar x:Name="Scroller"
DockPanel.Dock="Right"
Visibility="Visible"
Scroll="onScrollerScroll"/>
<ctrl:BindableRichTextBox x:Name="HexAddressPane"
x:FieldModifier="private"
Style="{StaticResource RtbPaneStyle}"
Foreground="Gray"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ShowAddressPane, Converter={StaticResource BooleanToVisibility}}"
Width="{Binding ElementName=HexAddrHeaderRtb, Path=Width}"
ScrollViewer.ScrollChanged="onRtbScrollChanged"/>
<ctrl:BindableRichTextBox x:Name="HexRawPane"
x:FieldModifier="private"
Style="{StaticResource RtbPaneStyle}"
Foreground="Gray"
ObserveCaret="True"
Width="{Binding ElementName=HexRawHeaderRtb, Path=Width}"
ScrollViewer.ScrollChanged="onRtbScrollChanged"/>
<ctrl:BindableRichTextBox x:Name="HexAsciiPane"
x:FieldModifier="private"
Style="{StaticResource RtbPaneStyle}"
Foreground="Green"
Visibility="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=ShowAsciiPane, Converter={StaticResource BooleanToVisibility}}"
Width="{Binding ElementName=HexAsciiHeaderRtb, Path=Width}"
ScrollViewer.ScrollChanged="onRtbScrollChanged"/>
</DockPanel>
</DockPanel>
</UserControl>