Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing the null color in the Preview and Watch Nodes #13131

Merged
merged 1 commit into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use str.equals() instead of '=='

{
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