Skip to content

Commit

Permalink
DYN-6440 Custom Selection node overlapping
Browse files Browse the repository at this point in the history
Adding a new TextBlock that when has a large text will wrap the text show at the end the chars: "..."
  • Loading branch information
RobertGlobant20 committed Feb 20, 2024
1 parent 8c8e9e0 commit cd055bf
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/DynamoCoreWpf/UI/Themes/Modern/DynamoModern.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1981,6 +1981,17 @@
Foreground="#F5F5F5"
IsReadOnly="{TemplateBinding IsReadOnly}"
Visibility="Hidden" />
<TextBlock x:Name="PART_ReadOnlyTextBlock"
Margin="0,0,25,4"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Focusable="True"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="18px"
Foreground="#F5F5F5"
TextWrapping="Wrap"
TextTrimming="CharacterEllipsis"
Visibility="Collapsed" />
<Popup Name="Popup"
AllowsTransparency="True"
Focusable="False"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using System.Windows.Controls;
using System.Windows;
using Dynamo.Wpf;
using CoreNodeModels;
using System.Windows.Data;

namespace CoreNodeModelsWpf.Nodes
{
Expand Down Expand Up @@ -36,6 +38,27 @@ public void CustomizeView(CustomSelection model, NodeView nodeView)
// Add margin to the dropdown to show the expander.
dropdown.Margin = new Thickness(leftMargin, 0, 0, 0);
dropdown.VerticalAlignment = VerticalAlignment.Top;
dropdown.ApplyTemplate();

var dropDownTextBlock = dropdown.Template.FindName("PART_ReadOnlyTextBlock", dropdown) as TextBlock;
if (dropDownTextBlock != null)
{
dropDownTextBlock.Visibility = Visibility.Visible;
}

var dropDownContent = dropdown.Template.FindName("ContentSite", dropdown) as ContentPresenter;
if (dropDownContent != null)
{
dropDownContent.Visibility = Visibility.Collapsed;
}

// Bind the TextBlock to the selected item hash.
var bindingVal = new Binding(nameof(DSDropDownBase.SelectedString))
{
Mode = BindingMode.TwoWay,
Source = model
};
dropDownTextBlock.SetBinding(TextBlock.TextProperty, bindingVal);
}

private void BaseComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
Expand Down

0 comments on commit cd055bf

Please sign in to comment.