Продолжение рефакторинга (вынесение WPF в отдельный проект)
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
<UserControl
|
||||
x:Class="Pf2e.WPF.EntityViewer.Component.ViewControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:component="clr-namespace:Pf2e.WPF.EntityViewer.Component"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:fa="http://schemas.awesome.incremented/wpf/xaml/fontawesome.sharp"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:struct="clr-namespace:Pf2e.WPF.EntityViewer.EntityViewStructure"
|
||||
xmlns:viewmodel="clr-namespace:Pf2e.WPF.EntityViewer.ViewModel"
|
||||
x:Name="_this"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:ViewViewModel}"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="300"
|
||||
x:ClassModifier="internal"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<UserControl.Resources>
|
||||
<FontFamily x:Key="FontAwesome">/FontAwesome.Sharp;component/fonts/#Font Awesome 6 Free Solid</FontFamily>
|
||||
|
||||
<struct:ColorAdapterConverter x:Key="ColorAdapterConverter" />
|
||||
|
||||
<Style x:Key="ButtonStyle" TargetType="Button">
|
||||
<Setter Property="FontSize" Value="{Binding ButtonSize, ElementName=_this}" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Width" Value="{Binding ButtonSize, ElementName=_this}" />
|
||||
<Setter Property="Height" Value="{Binding ButtonSize, ElementName=_this}" />
|
||||
<Setter Property="BorderThickness" Value="2,2,1,1" />
|
||||
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
<Setter Property="Foreground" Value="Black" />
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Foreground" Value="DarkSlateGray" />
|
||||
<Setter Property="Background">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Transparent" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<SolidColorBrush Color="Transparent" />
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style
|
||||
x:Key="FaButtonStyle"
|
||||
BasedOn="{StaticResource ButtonStyle}"
|
||||
TargetType="Button">
|
||||
<Setter Property="FontFamily" Value="{StaticResource FontAwesome}" />
|
||||
</Style>
|
||||
|
||||
<Style x:Key="HoverRow" TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrush}}" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<UserControl.BorderBrush>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ActiveBorderColorKey}}" />
|
||||
</UserControl.BorderBrush>
|
||||
|
||||
<UserControl.Background>
|
||||
<SolidColorBrush Color="{DynamicResource {x:Static SystemColors.ControlColorKey}}" />
|
||||
</UserControl.Background>
|
||||
|
||||
<ScrollViewer>
|
||||
<ItemsControl AlternationCount="2" ItemsSource="{Binding Rows}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Grid.IsSharedSizeScope="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid
|
||||
x:Name="FooBar"
|
||||
Height="{Binding ItemHeight, ElementName=_this}"
|
||||
Visibility="{Binding ItemVisibility}">
|
||||
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition SharedSizeGroup="ColumnOne" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<StackPanel Grid.Column="0" Orientation="Horizontal">
|
||||
<component:ViewLadder
|
||||
Width="65"
|
||||
Height="{Binding ItemHeight, ElementName=_this}"
|
||||
DepthSize="{Binding DepthSize, ElementName=_this}"
|
||||
Ladder="{Binding Ladder}" />
|
||||
|
||||
<Button
|
||||
Margin="-20,0,0,0"
|
||||
Padding="0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding CollapseCommand}"
|
||||
Style="{StaticResource FaButtonStyle}"
|
||||
Visibility="{Binding ButtonVisibility}">
|
||||
<TextBlock Margin="-3,-3,0,0" Text="{Binding ButtonIcon}" />
|
||||
</Button>
|
||||
|
||||
<TextBlock
|
||||
Margin="2,0,10,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Name}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Column="1" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="0,0,5,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="{Binding TypeFontSize, ElementName=_this}"
|
||||
FontStyle="Italic"
|
||||
Text="{Binding Type}">
|
||||
<TextBlock.Foreground>
|
||||
<MultiBinding Converter="{StaticResource ColorAdapterConverter}">
|
||||
<Binding Path="AccentColor" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Foreground>
|
||||
</TextBlock>
|
||||
<TextBox
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding Value, Mode=OneWay}">
|
||||
<TextBox.Foreground>
|
||||
<MultiBinding Converter="{StaticResource ColorAdapterConverter}">
|
||||
<Binding Path="AccentColor" />
|
||||
</MultiBinding>
|
||||
</TextBox.Foreground>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<DataTemplate.Triggers>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
|
||||
<Setter TargetName="FooBar" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrush}}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
|
||||
<Setter TargetName="FooBar" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrush}}" />
|
||||
</Trigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user