Skip to content

Commit

Permalink
Dealing the null color (#13131)
Browse files Browse the repository at this point in the history
  • Loading branch information
jesusalvino authored Jul 22, 2022
1 parent ac8a987 commit ab06d83
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
29 changes: 20 additions & 9 deletions src/DynamoCoreWpf/UI/Converters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3280,20 +3280,20 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
{
throw new NotImplementedException();
}
}
}

/// <summary>
/// Converts the object type to forground color for the object.
/// </summary>
public class ObjectTypeConverter : IValueConverter
public class ObjectTypeConverter : IMultiValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var resourceDictionary = SharedDictionaryManager.DynamoColorsAndBrushesDictionary;

if (value != null)
if (values != null)
{
switch (value)
switch (values[0])
{
case WatchViewModel.objectType:
return resourceDictionary["objectLabelBackground"] as SolidColorBrush;
Expand All @@ -3304,14 +3304,25 @@ public object Convert(object value, Type targetType, object parameter, System.Gl
case WatchViewModel.stringType:
return resourceDictionary["stringLabelBackground"] as SolidColorBrush;
case WatchViewModel.boolType:
return resourceDictionary["boolLabelBackground"] as SolidColorBrush;
return resourceDictionary["boolLabelBackground"] as SolidColorBrush;
default:
return resourceDictionary["PrimaryCharcoal200Brush"] as SolidColorBrush;
if (values[1].ToString() == "List")
{
return resourceDictionary["PrimaryCharcoal200Brush"] as SolidColorBrush;
}
else
{
return resourceDictionary["nullLabelBackground"] as SolidColorBrush;
}
};
}
return resourceDictionary["PrimaryCharcoal200Brush"] as SolidColorBrush;
else
{
return resourceDictionary["PrimaryCharcoal200Brush"] as SolidColorBrush;
}
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
Color="#EEEEEE" />
<SolidColorBrush x:Key="boolLabelBackground"
Color="#F9F9A5" />
<SolidColorBrush x:Key="nullLabelBackground"
Color="#F9F9A5" />

<!-- Node Autocomplete -->
<SolidColorBrush x:Key="autocompletionWindow" Color="#535353" />
Expand Down
14 changes: 10 additions & 4 deletions src/DynamoCoreWpf/Views/Preview/WatchTree.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@
<TextBlock x:Name="listIndex"
Width="Auto"
Margin="{Binding Path=IsCollection, Converter={StaticResource ListIndexMarginConverter}}"
Padding="0,0,0,-1"
Padding="0,0,0,-1"
VerticalAlignment="Center"
Background="{Binding Path=IsCollection, Converter={StaticResource ListIndexBackgroundConverter}}"
FontFamily="{StaticResource SourceCodePro}"
Expand All @@ -352,11 +352,17 @@

<TextBlock Width="Auto"
Margin="{Binding Path=IsTopLevel, Converter={StaticResource TopLevelLabelMarginConverter}}"
VerticalAlignment="Center"
Foreground="{Binding Path=ValueType, Converter={StaticResource ObjectTypeConverter}}"
VerticalAlignment="Center"
FontFamily="{StaticResource SourceCodePro}"
Text="{Binding Path=NodeLabel}"
Visibility="{Binding Path=NodeLabel, Converter={StaticResource EmptyStringToCollapsedConverter}}" />
Visibility="{Binding Path=NodeLabel, Converter={StaticResource EmptyStringToCollapsedConverter}}" >
<TextBlock.Foreground>
<MultiBinding Converter="{StaticResource ObjectTypeConverter}">
<Binding Path="ValueType" />
<Binding Path="NodeLabel" />
</MultiBinding>
</TextBlock.Foreground>
</TextBlock>

<Button Margin="10,2,2,2"
Padding="4,0,4,0"
Expand Down

0 comments on commit ab06d83

Please sign in to comment.