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

Dyn 4843 watch node smaller #12829

Merged
merged 25 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
98dfeda
Merge pull request #1 from DynamoDS/master
jesusalvino Jan 18, 2022
8a8e4bb
Merge branch 'DynamoDS:master' into master
jesusalvino Jan 26, 2022
c214c77
Merge branch 'DynamoDS:master' into master
jesusalvino Jan 28, 2022
422cee9
Merge branch 'DynamoDS:master' into master
jesusalvino Feb 6, 2022
f815528
Merge branch 'DynamoDS:master' into master
jesusalvino Feb 8, 2022
d48c72a
Merge branch 'DynamoDS:master' into master
jesusalvino Feb 12, 2022
3671b95
Merge branch 'DynamoDS:master' into master
jesusalvino Feb 15, 2022
36ea946
Merge branch 'DynamoDS:master' into master
jesusalvino Feb 22, 2022
d7bb37b
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 1, 2022
32befba
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 7, 2022
2f2b375
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 7, 2022
6ed0cb8
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 8, 2022
76b40f5
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 11, 2022
b9505de
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 14, 2022
150f432
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 16, 2022
c088daf
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 17, 2022
2493ac0
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 22, 2022
4c6041e
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 24, 2022
4f6b37c
Merge branch 'DynamoDS:master' into master
jesusalvino Mar 31, 2022
e095a69
Merge branch 'DynamoDS:master' into master
jesusalvino Apr 11, 2022
5b37482
Merge branch 'DynamoDS:master' into master
jesusalvino Apr 21, 2022
2cc9191
Watch Node height size behavior
jesusalvino Apr 26, 2022
0ecb530
Dealing with the Width and reducing the Height as minimum
jesusalvino Apr 28, 2022
e426576
Dynamic Width
jesusalvino Apr 30, 2022
507b236
Max width of a Watch node
jesusalvino May 2, 2022
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
9 changes: 6 additions & 3 deletions src/DynamoCoreWpf/Views/Preview/WatchTree.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@
<Setter Property="Margin" Value="-10,5,5,5" />
</DataTrigger>
<DataTrigger Binding="{Binding IsOneRowContent}" Value="False">
<Setter Property="Margin" Value="5,5,5,5" />
<Setter Property="Margin" Value="5,0,5,5" />
</DataTrigger>
<DataTrigger Binding="{Binding IsCollection}" Value="false">
<Setter Property="Margin" Value="-5,0,0,0" />
</DataTrigger>
</Style.Triggers>
</Style>
Expand Down Expand Up @@ -377,7 +380,7 @@
CornerRadius="0,0,2,2"
BorderThickness="0">

<DockPanel Name="ListLevelsDisplay" Height="27px">
<DockPanel Name="ListLevelsDisplay" Height="27px" Visibility="{Binding IsCollection, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">

<!-- A draggable control to resize the Watch window -->
<Thumb Name="resizeThumb"
Expand Down Expand Up @@ -446,7 +449,7 @@
<TextBlock Name="indivListLevel"
FontFamily="{StaticResource SourceCodePro}"
FontSize="10">
L<Run Foreground="#D3D3D3" Text="{Binding Path=.}" />
<Run Foreground="#D3D3D3" Text="{Binding Path=.}" />
</TextBlock>
</StackPanel>
</DataTemplate>
Expand Down
51 changes: 45 additions & 6 deletions src/DynamoCoreWpf/Views/Preview/WatchTree.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,66 @@ public partial class WatchTree : UserControl
{
private WatchViewModel _vm;
private WatchViewModel prevWatchViewModel;
private readonly int defaultSize = 200;
private readonly int minSize = 100;
private readonly int defaultWidthSize = 200;
private readonly int defaultHeightSize = 200;
private readonly int minWidthSize = 100;
private readonly int minHeightSize = 38;

public WatchTree()
{
InitializeComponent();
this.Loaded += WatchTree_Loaded;
this.Unloaded += WatchTree_Unloaded;
}

private void WatchTree_Unloaded(object sender, RoutedEventArgs e)
{
_vm.PropertyChanged -= _vm_PropertyChanged;
}

void WatchTree_Loaded(object sender, RoutedEventArgs e)
{
_vm = this.DataContext as WatchViewModel;
_vm.PropertyChanged += _vm_PropertyChanged;
Copy link
Contributor

Choose a reason for hiding this comment

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

can we unsubscribe this somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

}

private void _vm_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "IsCollection")
{
if (_vm.IsCollection)
{
this.Height = defaultHeightSize;
}
else
{
this.Height = minHeightSize;
}
}
else if (e.PropertyName == "Children")
{
if (_vm.Children != null)
{
if (!_vm.Children[0].IsCollection)
{
double requiredWidth = (_vm.Children[0].NodeLabel.Length * 7.5) + 20;
this.Width = requiredWidth;
}
else
{
this.Width = defaultWidthSize;
}
}
}
}

internal void SetWatchNodeProperties()
{
resizeThumb.Visibility = Visibility.Visible;
this.Width = defaultSize;
this.Height = defaultSize;
inputGrid.MinHeight = minSize;
inputGrid.MinWidth = minSize;
this.Width = defaultWidthSize;
this.Height = minHeightSize;
inputGrid.MinHeight = minHeightSize;
inputGrid.MinWidth = minWidthSize;
}

private void Button_Click(object sender, RoutedEventArgs e)
Expand Down