Skip to content

Commit f651178

Browse files
authored
DYN-8802: Use Panel based port size calculation only for CodeBlockNodes (#16184)
1 parent 29f3923 commit f651178

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/DynamoCoreWpf/UI/Converters.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,30 @@ public object ConvertBack(object value, Type targetType, object parameter, Syste
17621762
}
17631763
}
17641764

1765+
/// <summary>
1766+
/// Used to set the port style of a Code Block node.
1767+
/// </summary>
1768+
[System.Diagnostics.CodeAnalysis.SuppressMessage("ApiDesign",
1769+
"RS0016:Add public types and members to the declared API",
1770+
Justification = "Converters are not part of the API")]
1771+
public class NodeModelToPortStyleConverter : IValueConverter
1772+
{
1773+
public Style PortStyle { get; set; }
1774+
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
1775+
{
1776+
if (value is CodeBlockNodeModel)
1777+
{
1778+
return PortStyle;
1779+
}
1780+
return DependencyProperty.UnsetValue;
1781+
}
1782+
1783+
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
1784+
{
1785+
throw new NotSupportedException();
1786+
}
1787+
}
1788+
17651789
public class LacingToVisibilityConverter : IValueConverter
17661790
{
17671791
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)

src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2791,6 +2791,9 @@
27912791
</Setter.Value>
27922792
</Setter>
27932793
</Style>
2794+
<conv:NodeModelToPortStyleConverter
2795+
x:Key="NodeModelToPortStyleConverter"
2796+
PortStyle="{StaticResource InOutPortControlStyle}" />
27942797

27952798
<Style x:Key="{x:Type dynui:ImageCheckBox}" TargetType="{x:Type dynui:ImageCheckBox}">
27962799
<Setter Property="SnapsToDevicePixels" Value="true" />

src/DynamoCoreWpf/Views/Core/NodeView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@
407407
HorizontalContentAlignment="Stretch"
408408
Canvas.ZIndex="6"
409409
ItemsSource="{Binding Path=InPorts}"
410-
Style="{StaticResource InOutPortControlStyle}" />
410+
Style="{Binding Path=NodeModel, Converter={StaticResource NodeModelToPortStyleConverter}}" />
411411

412412
<!-- OUTPUT PORTS -->
413413
<ItemsControl Name="outputPortControl"
@@ -418,7 +418,7 @@
418418
HorizontalContentAlignment="Stretch"
419419
Canvas.ZIndex="4"
420420
ItemsSource="{Binding Path=OutPorts}"
421-
Style="{StaticResource InOutPortControlStyle}" />
421+
Style="{Binding Path=NodeModel, Converter={StaticResource NodeModelToPortStyleConverter}}" />
422422

423423
<Grid Name="centralGrid"
424424
Grid.Row="2"

0 commit comments

Comments
 (0)