Skip to content

Commit 201b212

Browse files
authored
Merge pull request #49 from ivangrek/fix-34
Collapse Published Date row when date is null
2 parents 52c2db9 + ddb4364 commit 201b212

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

src/PackageManager.UI/Views/Browser.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@
159159
</TextBlock>
160160

161161
<!-- Published Date -->
162-
<Label Grid.Row="3" Grid.Column="0" Content="Published Date:" />
163-
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Published, Mode=OneWay}" />
162+
<Label Grid.Row="3" Grid.Column="0" Content="Published Date:" Visibility="{Binding PublishedVisibility, Mode=OneWay}"/>
163+
<TextBlock Grid.Row="3" Grid.Column="1" Text="{Binding Published, Mode=OneWay}" Visibility="{Binding PublishedVisibility, Mode=OneWay}" />
164164

165165
<!-- Project URL -->
166166
<Label Grid.Row="4" Grid.Column="0" Content="Project URL:" />

src/PackageManager/PackageManager.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
<PackageReference Include="Neptuo.Observables" Version="2.0.0" />
1111
</ItemGroup>
1212

13+
<ItemGroup>
14+
<Reference Include="PresentationCore" />
15+
</ItemGroup>
16+
1317
</Project>

src/PackageManager/ViewModels/PackageViewModel.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@
55
using PackageManager.Models;
66
using System;
77
using System.Collections.Generic;
8-
using System.Linq;
9-
using System.Text;
108
using System.Threading;
119
using System.Threading.Tasks;
10+
using System.Windows;
1211

1312
namespace PackageManager.ViewModels
1413
{
@@ -25,6 +24,10 @@ public class PackageViewModel : ObservableModel
2524
public string Description => model.Description;
2625
public string Authors => model.Authors;
2726
public DateTime? Published => model.Published;
27+
public Visibility PublishedVisibility => Published is null
28+
? Visibility.Collapsed
29+
: Visibility.Visible;
30+
2831
public string Tags => model.Tags;
2932
public Uri IconUrl => model.IconUrl;
3033
public Uri ProjectUrl => model.ProjectUrl;

0 commit comments

Comments
 (0)