下载列表添加无数据显示

croire 3 years ago
parent e06f3a51ce
commit 2ffa86420a

@ -0,0 +1,21 @@
using System;
using System.Globalization;
using System.Windows.Data;
namespace DownKyi.Converter
{
public class CountConverter : IValueConverter
{
public int Count { get; set; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return ((int)value) > Count;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

@ -79,6 +79,7 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Converter\CountConverter.cs" />
<Compile Include="CustomControl\GifImage.cs" /> <Compile Include="CustomControl\GifImage.cs" />
<Compile Include="Events\MessageEvent.cs" /> <Compile Include="Events\MessageEvent.cs" />
<Compile Include="Events\NavigationEvent.cs" /> <Compile Include="Events\NavigationEvent.cs" />
@ -447,6 +448,7 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Resource Include="Resources\checked.png" /> <Resource Include="Resources\checked.png" />
<Resource Include="Resources\nodata02.png" />
<Content Include="打不开DownKyi请点我.txt"> <Content Include="打不开DownKyi请点我.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

@ -2,10 +2,13 @@
x:Class="DownKyi.Views.DownloadManager.ViewDownloading" x:Class="DownKyi.Views.DownloadManager.ViewDownloading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converter="clr-namespace:DownKyi.Converter"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors" xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/" xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"> prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources> <UserControl.Resources>
<converter:CountConverter x:Key="CountConverter" Count="0" />
<Style x:Key="DownloadingStyle" TargetType="{x:Type ListBoxItem}"> <Style x:Key="DownloadingStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
@ -225,6 +228,21 @@
<RowDefinition Height="1" /> <RowDefinition Height="1" />
<RowDefinition Height="50" /> <RowDefinition Height="50" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Triggers>
<DataTrigger Binding="{Binding DownloadingList}" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count}" Value="0">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<ListBox <ListBox
Grid.Row="0" Grid.Row="0"
@ -316,5 +334,25 @@
</Grid> </Grid>
<!-- TODO 没有数据时显示图片或文字 --> <!-- TODO 没有数据时显示图片或文字 -->
<Image
Width="256"
Height="256"
Source="/DownKyi;component/Resources/nodata02.png">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding DownloadingList}" Value="{x:Null}">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count}" Value="0">
<Setter Property="Visibility" Value="Visible" />
</DataTrigger>
<DataTrigger Binding="{Binding DownloadingList.Count, Converter={StaticResource CountConverter}}" Value="true">
<Setter Property="Visibility" Value="Collapsed" />
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
</Grid> </Grid>
</UserControl> </UserControl>

Loading…
Cancel
Save