Skip to content

Commit

Permalink
Hide name
Browse files Browse the repository at this point in the history
  • Loading branch information
RicoSuter committed Oct 1, 2018
1 parent 241d021 commit 7f1d3d3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
@@ -0,0 +1,26 @@
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace ProjectDependencyBrowser.Converters
{
public class ShowProjectNameConverter : IValueConverter
{
/// <summary>Converts a value. </summary>
/// <returns>A converted value. If the method returns null, the valid null value is used. </returns>
/// <param name="value">The value produced by the binding source.</param><param name="targetType">The type of the binding target property.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.IsNullOrEmpty((value as MyToolkit.Build.VsProject)?.NuGetPackageId) ? Visibility.Visible : Visibility.Collapsed;
}

/// <summary>Converts a value. </summary>
/// <returns>A converted value. If the method returns null, the valid null value is used. </returns>
/// <param name="value">The value that is produced by the binding target.</param><param name="targetType">The type to convert to.</param><param name="parameter">The converter parameter to use.</param><param name="culture">The culture to use in the converter.</param>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Expand Up @@ -152,6 +152,7 @@
<Compile Include="Analyzers\Test\NuGetPackageDependencyAnalyzer.cs" />
<Compile Include="Converters\AssemblyReferenceColorConverter.cs" />
<Compile Include="Converters\ProjectTypesConverter.cs" />
<Compile Include="Converters\ShowProjectNameConverter.cs" />
<Compile Include="Messages\ShowProjectDetails.cs" />
<Compile Include="Messages\ShowProjectMessage.cs" />
<Compile Include="ViewModels\MainWindowModel.cs" />
Expand Down
2 changes: 1 addition & 1 deletion src/ProjectDependencyBrowser/Views/MainWindow.xaml
Expand Up @@ -44,7 +44,7 @@
</ContextMenu>
</StackPanel.ContextMenu>

<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="{Binding Name}" Visibility="{Binding Converter={StaticResource ShowProjectNameConverter}}" FontWeight="Bold" />
<TextBlock Text="{Binding NuGetPackageId}" Foreground="DarkBlue" FontWeight="Bold"
Visibility="{Binding NuGetPackageId, Converter={StaticResource VisibilityConverter}}" />
<TextBlock Text="{Binding FileName}" />
Expand Down

0 comments on commit 7f1d3d3

Please sign in to comment.