|
|
|
|
@ -0,0 +1,133 @@ |
|
|
|
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|
|
|
|
xmlns:local="clr-namespace:MultiTerm.Wpf.CustomControl" |
|
|
|
|
xmlns:wpftk="clr-namespace:WpfToolkit.Controls;assembly=VirtualizingWrapPanel"> |
|
|
|
|
|
|
|
|
|
<Style TargetType="{x:Type local:MultiFormatDataView}"> |
|
|
|
|
<Style.Resources> |
|
|
|
|
<SolidColorBrush x:Key="CHAR_Background" Color="#B4EBEB"/> |
|
|
|
|
<SolidColorBrush x:Key="HEX_Background" Color="#C8C8FF"/> |
|
|
|
|
<SolidColorBrush x:Key="BIN_Background" Color="#C8FFC8"/> |
|
|
|
|
<DataTemplate x:Key="dataContainerTemplate"> |
|
|
|
|
<StackPanel Orientation="Vertical" Margin="0 0 5 0"> |
|
|
|
|
<!-- Character --> |
|
|
|
|
<Border BorderThickness="0"> |
|
|
|
|
<Label Content="{Binding DisplayStringUtf16}"> |
|
|
|
|
<Label.Style> |
|
|
|
|
<Style TargetType="Label"> |
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Left"/> |
|
|
|
|
<Style.Triggers> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbHex,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Right"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbBin,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="HorizontalAlignment" Value="Right"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
</Style.Triggers> |
|
|
|
|
</Style> |
|
|
|
|
</Label.Style> |
|
|
|
|
</Label> |
|
|
|
|
<Border.Style> |
|
|
|
|
<Style TargetType="Border"> |
|
|
|
|
<Setter Property="Visibility" Value="Collapsed"/> |
|
|
|
|
<Setter Property="Background" Value="Transparent"/> |
|
|
|
|
<Style.Triggers> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbCharacter,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="Visibility" Value="Visible"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbHex,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="Background" Value="{StaticResource CHAR_Background}"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbBin,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="Background" Value="{StaticResource CHAR_Background}"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
</Style.Triggers> |
|
|
|
|
</Style> |
|
|
|
|
</Border.Style> |
|
|
|
|
</Border> |
|
|
|
|
<!-- Hexadecimal --> |
|
|
|
|
<Border BorderThickness="0" Background="{StaticResource HEX_Background}"> |
|
|
|
|
<Label Content="{Binding DisplayStringHex}" HorizontalAlignment="Right"/> |
|
|
|
|
<Border.Style> |
|
|
|
|
<Style TargetType="Border"> |
|
|
|
|
<Setter Property="Visibility" Value="Collapsed"/> |
|
|
|
|
<Style.Triggers> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbHex,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="Visibility" Value="Visible"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
</Style.Triggers> |
|
|
|
|
</Style> |
|
|
|
|
</Border.Style> |
|
|
|
|
</Border> |
|
|
|
|
<!-- Binary --> |
|
|
|
|
<Border BorderThickness="0" Background="{StaticResource BIN_Background}"> |
|
|
|
|
<Label Content="{Binding DisplayStringBin}" HorizontalAlignment="Right"/> |
|
|
|
|
<Border.Style> |
|
|
|
|
<Style TargetType="Border"> |
|
|
|
|
<Setter Property="Visibility" Value="Collapsed"/> |
|
|
|
|
<Style.Triggers> |
|
|
|
|
<DataTrigger Binding="{Binding ElementName=cbBin,Path=IsChecked}" Value="True"> |
|
|
|
|
<Setter Property="Visibility" Value="Visible"/> |
|
|
|
|
</DataTrigger> |
|
|
|
|
</Style.Triggers> |
|
|
|
|
</Style> |
|
|
|
|
</Border.Style> |
|
|
|
|
</Border> |
|
|
|
|
</StackPanel> |
|
|
|
|
</DataTemplate> |
|
|
|
|
</Style.Resources> |
|
|
|
|
|
|
|
|
|
<!-- Template --> |
|
|
|
|
<Setter Property="Template"> |
|
|
|
|
<Setter.Value> |
|
|
|
|
<ControlTemplate TargetType="{x:Type local:MultiFormatDataView}"> |
|
|
|
|
<DockPanel> |
|
|
|
|
<GroupBox Header="Display Formats" DockPanel.Dock="Top"> |
|
|
|
|
<StackPanel Orientation="Horizontal" > |
|
|
|
|
<CheckBox Content="Character" x:Name="cbCharacter" Padding="20 0" IsChecked="True"/> |
|
|
|
|
<CheckBox Content="Hexadecimal" x:Name="cbHex" Padding="20 0"/> |
|
|
|
|
<CheckBox Content="Binary" x:Name="cbBin" Padding="20 0"/> |
|
|
|
|
</StackPanel> |
|
|
|
|
</GroupBox> |
|
|
|
|
<ItemsControl ItemsSource="{TemplateBinding DataSource}" |
|
|
|
|
ScrollViewer.VerticalScrollBarVisibility="Auto" |
|
|
|
|
ScrollViewer.CanContentScroll="true" |
|
|
|
|
ScrollViewer.PanningMode="VerticalOnly" |
|
|
|
|
HorizontalAlignment="Left"> |
|
|
|
|
<ItemsControl.Template> |
|
|
|
|
<ControlTemplate> |
|
|
|
|
<ScrollViewer> |
|
|
|
|
<ItemsPresenter/> |
|
|
|
|
</ScrollViewer> |
|
|
|
|
</ControlTemplate> |
|
|
|
|
</ItemsControl.Template> |
|
|
|
|
|
|
|
|
|
<ItemsControl.ItemTemplate> |
|
|
|
|
<DataTemplate> |
|
|
|
|
<ItemsControl ItemsSource="{Binding Characters}" HorizontalAlignment="Left" |
|
|
|
|
ItemTemplate="{StaticResource dataContainerTemplate}"> |
|
|
|
|
<ItemsControl.ItemsPanel> |
|
|
|
|
<ItemsPanelTemplate> |
|
|
|
|
<UniformGrid Rows="1" HorizontalAlignment="Left"/> |
|
|
|
|
</ItemsPanelTemplate> |
|
|
|
|
</ItemsControl.ItemsPanel> |
|
|
|
|
</ItemsControl> |
|
|
|
|
</DataTemplate> |
|
|
|
|
</ItemsControl.ItemTemplate> |
|
|
|
|
|
|
|
|
|
<ItemsControl.ItemsPanel> |
|
|
|
|
<ItemsPanelTemplate> |
|
|
|
|
<wpftk:VirtualizingWrapPanel Orientation="Vertical" |
|
|
|
|
VirtualizingPanel.CacheLengthUnit="Item" |
|
|
|
|
VirtualizingPanel.ScrollUnit="Item"> |
|
|
|
|
</wpftk:VirtualizingWrapPanel> |
|
|
|
|
</ItemsPanelTemplate> |
|
|
|
|
</ItemsControl.ItemsPanel> |
|
|
|
|
|
|
|
|
|
</ItemsControl> |
|
|
|
|
</DockPanel> |
|
|
|
|
</ControlTemplate> |
|
|
|
|
</Setter.Value> |
|
|
|
|
</Setter> |
|
|
|
|
</Style> |
|
|
|
|
</ResourceDictionary> |