Skip to content

Commit

Permalink
remove space below filters (#14406)
Browse files Browse the repository at this point in the history
* remove space below filters

- removed the spacing between the filters bar and the datagrid

* visual aligment of ui elements

- slight adjustment to match design intention
  • Loading branch information
dnenov authored Sep 15, 2023
1 parent 8c4e94a commit a061335
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
25 changes: 25 additions & 0 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1440,6 +1440,31 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
}
}

/// <summary>
/// Takes a boolean value and if the value is true returns Unity Type Auto (*) as a length value
/// Returns 0 length if the value is false
/// To be used in Grid Column/Row width
/// </summary>
public class BoolToZeroLengthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if ((bool)value)
{
return new GridLength(1, GridUnitType.Auto);
}
else
{
return new GridLength(0);
}
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
}

/// <summary>
/// Used in the Dynamo package manager search window to hide or show a label next to each package's name.
/// The label only appears if the package has been recently created/updated (in the last 30 days).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Dynamo.UI;assembly=DynamoCoreWpf">

<ResourceDictionary.MergedDictionaries>
Expand Down Expand Up @@ -148,6 +148,7 @@
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="FontSize" Value="11"></Setter>
<Setter Property="FontFamily" Value="{DynamicResource ArtifaktElementRegular}"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
Expand Down Expand Up @@ -178,4 +179,4 @@
</Style>


</ResourceDictionary>
</ResourceDictionary>
22 changes: 15 additions & 7 deletions src/GraphNodeManagerViewExtension/GraphNodeManagerView.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<UserControl x:Class="Dynamo.GraphNodeManager.GraphNodeManagerView"
<UserControl x:Class="Dynamo.GraphNodeManager.GraphNodeManagerView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Expand All @@ -23,6 +23,7 @@
</ResourceDictionary.MergedDictionaries>
<dynconverters:BoolToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<dynconverters:InverseBoolToVisibilityConverter x:Key="InverseBooleanToVisibilityConverter"></dynconverters:InverseBoolToVisibilityConverter>
<dynconverters:BoolToZeroLengthConverter x:Key="BoolToZeroLengthConverter"></dynconverters:BoolToZeroLengthConverter>
<converters:StateToVisibilityCollapsedConverter x:Key="StateToVisibilityCollapsedConverter"/>
<converters:StateToColorBrushConverter x:Key="StateToColorBrushConverter"/>
<converters:StateToImageSourceConverter x:Key="StateToImageSourceConverter"/>
Expand All @@ -43,11 +44,17 @@
</Grid.RowDefinitions>

<!-- Search Bar -->
<controls:SearchBoxControl Grid.Row="0" Margin="10 5 20 5"/>
<controls:SearchBoxControl Grid.Row="0" Margin="10 5 20 0"/>

<!-- Contains all filter icons -->
<DockPanel Grid.Row="1">
<Grid x:Name="FilterGrid" DockPanel.Dock="Top">
<Grid Grid.Row="1"
Margin="0 0 0 10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="{Binding IsAnyFilterOn,
Converter={StaticResource BoolToZeroLengthConverter}}"/>
</Grid.ColumnDefinitions>
<Grid x:Name="FilterGrid">
<ItemsControl x:Name="FilterItemControl"
Margin="5"
ItemsSource="{Binding FilterItems, UpdateSourceTrigger=PropertyChanged}">
Expand All @@ -66,15 +73,16 @@

<!-- Clear Filter Button -->
<Button x:Name="ClearFiltersButton"
DockPanel.Dock="Right"
Grid.Column="1"
Content="Clear all"
Margin="0 3 0 15"
Margin="0 3 10 15"
Width="60"
HorizontalAlignment="Right"
VerticalAlignment="Bottom"
Style="{StaticResource ButtonStyle1}"
Command="{Binding ClearFiltersCommand}"
Visibility="{Binding IsAnyFilterOn, Converter={StaticResource BooleanToVisibilityConverter}, UpdateSourceTrigger=PropertyChanged}"/>
</DockPanel>
</Grid>

<!-- Node Data Grid -->
<DataGrid x:Name="NodesInfoDataGrid"
Expand Down

0 comments on commit a061335

Please sign in to comment.