add listview style
This commit is contained in:
1 parent
c787df001b
commit
8ca34e6e5e
13 files changed
+180
-1
No files matched your search
@@ -439,6 +439,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Themes\Styles\ListView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Themes\Styles\Loading.xaml">
|
<Page Include="Themes\Styles\Loading.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
|
||||||
|
<Style x:Key="GridViewColumnHeaderGripper" TargetType="Thumb">
|
||||||
|
<Setter Property="Canvas.Right" Value="-9"/>
|
||||||
|
<Setter Property="Width" Value="18"/>
|
||||||
|
<Setter Property="Height" Value="{Binding ActualHeight, RelativeSource={RelativeSource TemplatedParent}}"/>
|
||||||
|
<Setter Property="Padding" Value="0"/>
|
||||||
|
<Setter Property="Background" Value="Transparent"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="Thumb">
|
||||||
|
<Border Background="Transparent" Padding="{TemplateBinding Padding}">
|
||||||
|
<Rectangle Fill="{TemplateBinding Background}" HorizontalAlignment="Center" Width="1"/>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="GridViewColumnHeader">
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="HorizontalContentAlignment" Value="Left"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Setter Property="Padding" Value="12,6,12,12"/>
|
||||||
|
<Setter Property="MinHeight" Value="44"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="GridViewColumnHeader">
|
||||||
|
<Grid SnapsToDevicePixels="true">
|
||||||
|
<Border x:Name="HeaderBorder" BorderBrush="{TemplateBinding BorderBrush}" Background="Transparent">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition MaxHeight="7"/>
|
||||||
|
<RowDefinition/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Border Padding="{TemplateBinding Padding}" Grid.RowSpan="2">
|
||||||
|
<ContentPresenter x:Name="HeaderContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="0,0,0,1" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
<Canvas>
|
||||||
|
<Thumb x:Name="PART_HeaderGripper" Style="{StaticResource GridViewColumnHeaderGripper}"/>
|
||||||
|
</Canvas>
|
||||||
|
</Grid>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style x:Key="ListViewItemBaseStyle" TargetType="ListViewItem">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="0"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Setter Property="SnapsToDevicePixels" Value="true"/>
|
||||||
|
<Setter Property="Margin" Value="0,0,0,4"/>
|
||||||
|
<Setter Property="Padding" Value="8,6"/>
|
||||||
|
<Setter Property="MinHeight" Value="44"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListViewItem">
|
||||||
|
<Border CornerRadius="4" x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
|
||||||
|
<GridViewRowPresenter Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}"/>
|
||||||
|
</Border>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsSelected" Value="True">
|
||||||
|
<Setter Property="Foreground" Value="White"/>
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="ListView">
|
||||||
|
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
|
||||||
|
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
|
||||||
|
<Setter Property="BorderThickness" Value="1"/>
|
||||||
|
<Setter Property="Padding" Value="6"/>
|
||||||
|
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
|
||||||
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
|
||||||
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
|
||||||
|
<Setter Property="ScrollViewer.PanningMode" Value="Both"/>
|
||||||
|
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
|
||||||
|
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||||
|
<Setter Property="ItemContainerStyle" Value="{StaticResource ListViewItemBaseStyle}"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="ListView">
|
||||||
|
<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
|
||||||
|
<ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
|
||||||
|
<ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
|
||||||
|
</ScrollViewer>
|
||||||
|
</Border>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
<Style.Triggers>
|
||||||
|
<MultiTrigger>
|
||||||
|
<MultiTrigger.Conditions>
|
||||||
|
<Condition Property="IsGrouping" Value="true"/>
|
||||||
|
<Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
|
||||||
|
</MultiTrigger.Conditions>
|
||||||
|
<Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
|
||||||
|
</MultiTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
<ResourceDictionary Source="CalendarWithClock.xaml"/>
|
<ResourceDictionary Source="CalendarWithClock.xaml"/>
|
||||||
<ResourceDictionary Source="DateTimePicker.xaml"/>
|
<ResourceDictionary Source="DateTimePicker.xaml"/>
|
||||||
<ResourceDictionary Source="GroupBox.xaml"/>
|
<ResourceDictionary Source="GroupBox.xaml"/>
|
||||||
|
<ResourceDictionary Source="ListView.xaml"/>
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -96,6 +96,8 @@
|
|||||||
|
|
||||||
public static readonly string GroupBoxDemoCtl = nameof(GroupBoxDemoCtl);
|
public static readonly string GroupBoxDemoCtl = nameof(GroupBoxDemoCtl);
|
||||||
|
|
||||||
|
public static readonly string ListViewDemoCtl = nameof(ListViewDemoCtl);
|
||||||
|
|
||||||
public static readonly string CommonWindow = nameof(CommonWindow);
|
public static readonly string CommonWindow = nameof(CommonWindow);
|
||||||
|
|
||||||
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
|
public static readonly string CustomNonClientAreaWindow = nameof(CustomNonClientAreaWindow);
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ var styleList = new List<string>
|
|||||||
"NaiveScrollViewerDemoCtl",
|
"NaiveScrollViewerDemoCtl",
|
||||||
"BrushDemoCtl",
|
"BrushDemoCtl",
|
||||||
"SliderDemoCtl",
|
"SliderDemoCtl",
|
||||||
"GroupBoxDemoCtl"
|
"GroupBoxDemoCtl",
|
||||||
|
"ListViewDemoCtl"
|
||||||
};
|
};
|
||||||
var windowList = new List<string>
|
var windowList = new List<string>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -186,6 +186,9 @@
|
|||||||
<Compile Include="UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
|
<Compile Include="UserControl\Styles\GroupBoxDemoCtl.xaml.cs">
|
||||||
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
|
<DependentUpon>GroupBoxDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="UserControl\Styles\ListViewDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>ListViewDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml.cs">
|
<Compile Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml.cs">
|
||||||
<DependentUpon>NaiveComboBoxDemoCtl.xaml</DependentUpon>
|
<DependentUpon>NaiveComboBoxDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -444,6 +447,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="UserControl\Styles\ListViewDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml">
|
<Page Include="UserControl\Styles\NaiveComboBoxDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -564,6 +571,7 @@
|
|||||||
<Generator>TextTemplatingFileGenerator</Generator>
|
<Generator>TextTemplatingFileGenerator</Generator>
|
||||||
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
<LastGenOutput>MessageToken.cs</LastGenOutput>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Resource Include="Resources\Img\LeftMainContent\ListView_16x.png" />
|
||||||
<Resource Include="Resources\Img\LeftMainContent\GroupBox_16x.png" />
|
<Resource Include="Resources\Img\LeftMainContent\GroupBox_16x.png" />
|
||||||
<Resource Include="Resources\Img\LeftMainContent\ColorWheel_16x.png" />
|
<Resource Include="Resources\Img\LeftMainContent\ColorWheel_16x.png" />
|
||||||
<Resource Include="Resources\Img\LeftMainContent\Slider_16x.png" />
|
<Resource Include="Resources\Img\LeftMainContent\Slider_16x.png" />
|
||||||
|
|||||||
@@ -501,6 +501,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 列表视图 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string ListView {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ListView", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 加载条 的本地化字符串。
|
/// 查找类似 加载条 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -408,4 +408,7 @@
|
|||||||
<data name="GroupBox" xml:space="preserve">
|
<data name="GroupBox" xml:space="preserve">
|
||||||
<value>GroupBox</value>
|
<value>GroupBox</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ListView" xml:space="preserve">
|
||||||
|
<value>ListView</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -388,4 +388,7 @@
|
|||||||
<data name="GroupBox" xml:space="preserve">
|
<data name="GroupBox" xml:space="preserve">
|
||||||
<value>分组框</value>
|
<value>分组框</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="ListView" xml:space="preserve">
|
||||||
|
<value>列表视图</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 167 B |
@@ -110,6 +110,11 @@
|
|||||||
<Image Source="../../Resources/Img/LeftMainContent/ListBox_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/ListBox_16x.png"/>
|
||||||
</controls:EdgeElement.LeftContent>
|
</controls:EdgeElement.LeftContent>
|
||||||
</ListBoxItem>
|
</ListBoxItem>
|
||||||
|
<ListBoxItem Tag="{x:Static data:MessageToken.ListViewDemoCtl}" Content="{x:Static langs:Lang.ListView}">
|
||||||
|
<controls:EdgeElement.LeftContent>
|
||||||
|
<Image Source="../../Resources/Img/LeftMainContent/ListView_16x.png"/>
|
||||||
|
</controls:EdgeElement.LeftContent>
|
||||||
|
</ListBoxItem>
|
||||||
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.GroupBoxDemoCtl}" Content="{x:Static langs:Lang.GroupBox}">
|
<ListBoxItem Style="{StaticResource ListBoxItemNew}" Tag="{x:Static data:MessageToken.GroupBoxDemoCtl}" Content="{x:Static langs:Lang.GroupBox}">
|
||||||
<controls:EdgeElement.LeftContent>
|
<controls:EdgeElement.LeftContent>
|
||||||
<Image Source="../../Resources/Img/LeftMainContent/GroupBox_16x.png"/>
|
<Image Source="../../Resources/Img/LeftMainContent/GroupBox_16x.png"/>
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.ListViewDemoCtl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
|
||||||
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<controls:TransitioningContentControl>
|
||||||
|
<ListView ItemsSource="{Binding DataList}">
|
||||||
|
<ListView.View>
|
||||||
|
<GridView>
|
||||||
|
<GridViewColumn Width="80" Header="{x:Static langs:Lang.Index}" DisplayMemberBinding="{Binding Index}"/>
|
||||||
|
<GridViewColumn Width="100" Header="{x:Static langs:Lang.Name}" DisplayMemberBinding="{Binding Name}"/>
|
||||||
|
<GridViewColumn Width="200" Header="{x:Static langs:Lang.Remark}" DisplayMemberBinding="{Binding Remark}"/>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
</controls:TransitioningContentControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class ListViewDemoCtl
|
||||||
|
{
|
||||||
|
public ListViewDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user