Skip to content

Commit fa56e79

Browse files
authored
DYN-9050: Improve buttons sizes (#16318)
1 parent a753883 commit fa56e79

10 files changed

Lines changed: 74 additions & 98 deletions
226 Bytes
Loading
213 Bytes
Loading
158 Bytes
Loading
-73 Bytes
Loading
166 Bytes
Loading
212 Bytes
Loading
103 Bytes
Loading

src/NodeAutoCompleteViewExtension/NodeAutoCompleteViewExtension.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ internal void AddToSidebar()
111111
internal void ShowViewExtension()
112112
{
113113
AddToSidebar();
114-
this.nodeAutocompleteMenuItem.IsChecked = true;
114+
if (this.nodeAutocompleteMenuItem != null)
115+
{
116+
this.nodeAutocompleteMenuItem.IsChecked = true;
117+
}
115118
}
116119

117120
public override void Loaded(ViewLoadedParams viewLoadedParams)
@@ -125,6 +128,7 @@ public override void Loaded(ViewLoadedParams viewLoadedParams)
125128
nodeAutoCompleteViewModel = new NodeAutoCompletePanelViewModel(viewLoadedParams.DynamoWindow, dynamoViewModel);
126129

127130
// Adding a button in view menu to refresh and show manually
131+
#if DEBUG
128132
nodeAutocompleteMenuItem = new MenuItem { Header = "Show NodeAutocomplete view extension", IsCheckable = true, IsChecked = false };
129133
nodeAutocompleteMenuItem.Click += (sender, args) =>
130134
{
@@ -140,6 +144,7 @@ public override void Loaded(ViewLoadedParams viewLoadedParams)
140144
}
141145
};
142146
viewLoadedParams.AddExtensionMenuItem(nodeAutocompleteMenuItem);
147+
#endif
143148
}
144149

145150
WorkspaceView.RequesNodeAutoCompleteBar += OnNodeAutoCompleteBarRequested;

src/NodeAutoCompleteViewExtension/ViewModels/NodeAutoCompleteBarViewModel.cs

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ internal IEnumerable<DNADropdownViewModel> DropdownResults
146146
RaisePropertyChanged(nameof(NthofTotal));
147147
RaisePropertyChanged(nameof(ResultsLoaded));
148148
RaisePropertyChanged(nameof(SwitchIsEnabled));
149-
RaisePropertyChanged(nameof(ConfirmSource));
150-
RaisePropertyChanged(nameof(PreviousSource));
151-
RaisePropertyChanged(nameof(NextSource));
149+
RaisePropertyChanged(nameof(HasPrevious));
150+
RaisePropertyChanged(nameof(HasNext));
152151
RaisePropertyChanged(nameof(FilteredView));
153152
}
154153
}
@@ -257,8 +256,8 @@ public int SelectedIndex
257256

258257
RaisePropertyChanged(nameof(SelectedIndex));
259258
RaisePropertyChanged(nameof(NthofTotal));
260-
RaisePropertyChanged(nameof(PreviousSource));
261-
RaisePropertyChanged(nameof(NextSource));
259+
RaisePropertyChanged(nameof(HasPrevious));
260+
RaisePropertyChanged(nameof(HasNext));
262261
}
263262
}
264263
}
@@ -296,35 +295,15 @@ internal void ToggleUndoRedoLocked(bool toggle = true)
296295
}
297296

298297
/// <summary>
299-
/// Bitmap Source for left caret
298+
/// Boolean, true if its possible to select a previous autocomplete option
300299
/// </summary>
301-
public string PreviousSource
302-
{
303-
get
304-
{
305-
return selectedIndex == 0 ? "/DynamoCoreWpf;component/UI/Images/caret-left-disabled.png" : "/DynamoCoreWpf;component/UI/Images/caret-left-default.png";
306-
}
307-
}
308-
/// <summary>
309-
/// Bitmap Source for right caret
310-
/// </summary>
311-
public string NextSource
312-
{
313-
get
314-
{
315-
return selectedIndex >= ClusterResultsCount - 1 ? "/DynamoCoreWpf;component/UI/Images/caret-right-disabled.png" : "/DynamoCoreWpf;component/UI/Images/caret-right-default.png";
316-
}
317-
}
300+
public bool HasPrevious => selectedIndex > 0;
301+
318302
/// <summary>
319-
/// Bitmap Source for confirmation checkmark
303+
/// Boolean, true if its possible to select a next autocomplete option
320304
/// </summary>
321-
public string ConfirmSource
322-
{
323-
get
324-
{
325-
return ResultsLoaded ? "/DynamoCoreWpf;component/UI/Images/check.png" : "/DynamoCoreWpf;component/UI/Images/check-disabled.png";
326-
}
327-
}
305+
public bool HasNext => selectedIndex < ClusterResultsCount - 1;
306+
328307
/// <summary>
329308
/// Language agnostic way of showing current result ordinal
330309
/// </summary>
@@ -966,6 +945,7 @@ internal void PopulateAutoComplete()
966945
//this should run on the UI thread, so thread safety is not a concern
967946
LastRequestGuid = Guid.NewGuid();
968947
var myRequest = LastRequestGuid;
948+
SelectedIndex = -1;
969949

970950
//start a background thread to make the http request
971951
Task.Run(() =>

src/NodeAutoCompleteViewExtension/Views/NodeAutoCompleteBarView.xaml

Lines changed: 57 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
Background="Transparent"
1414
ShowInTaskbar="False"
1515
ResizeMode="NoResize"
16-
Width="600"
1716
Height="45"
1817
PreviewKeyDown="OnAutoCompleteKeyDown"
1918
>
2019
<Window.Style>
2120
<Style TargetType="Window">
21+
<Setter Property="Width" Value="620" />
2222
<Style.Triggers>
2323
<DataTrigger Binding="{Binding IsDNAClusterPlacementEnabled}" Value="False">
24-
<Setter Property="Width" Value="500"/>
24+
<Setter Property="Width" Value="510"/>
2525
</DataTrigger>
2626
</Style.Triggers>
2727
</Style>
@@ -83,9 +83,8 @@
8383
<ColumnDefinition Width="Auto" />
8484
<ColumnDefinition Width="Auto" />
8585
<ColumnDefinition Width="Auto" />
86-
<ColumnDefinition Width="*" />
8786
<ColumnDefinition Width="Auto" />
88-
<ColumnDefinition Width="*" />
87+
<ColumnDefinition Width="Auto" />
8988
<ColumnDefinition Width="Auto" />
9089
<ColumnDefinition Width="Auto" />
9190
<ColumnDefinition Width="Auto" />
@@ -267,14 +266,25 @@
267266
<Grid>
268267
<Border x:Name="DotsBackgroundBorder"
269268
Background="Transparent"
270-
CornerRadius="2" />
269+
CornerRadius="2"
270+
Width="36"/>
271271
<Image x:Name="PrevImage"
272-
Source="{Binding PreviousSource}"
273-
Width="16px"
274-
Height="16px"
272+
Width="12px"
273+
Height="12px"
275274
HorizontalAlignment="Center"
276275
VerticalAlignment="Center"
277-
Stretch="UniformToFill" />
276+
Stretch="UniformToFill" >
277+
<Image.Style>
278+
<Style TargetType="Image">
279+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/caret-left-disabled.png"/>
280+
<Style.Triggers>
281+
<DataTrigger Binding="{Binding HasPrevious}" Value="True">
282+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/caret-left-default.png"/>
283+
</DataTrigger>
284+
</Style.Triggers>
285+
</Style>
286+
</Image.Style>
287+
</Image>
278288
</Grid>
279289
<ControlTemplate.Triggers>
280290
<Trigger Property="IsMouseOver"
@@ -319,14 +329,25 @@
319329
<Grid>
320330
<Border x:Name="DotsBackgroundBorder"
321331
Background="Transparent"
322-
CornerRadius="2" />
332+
CornerRadius="2"
333+
Width="36"/>
323334
<Image x:Name="NextImage"
324-
Source="{Binding NextSource}"
325-
Width="16px"
326-
Height="16px"
335+
Width="12px"
336+
Height="12px"
327337
HorizontalAlignment="Center"
328338
VerticalAlignment="Center"
329-
Stretch="UniformToFill" />
339+
Stretch="UniformToFill" >
340+
<Image.Style>
341+
<Style TargetType="Image">
342+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/caret-right-disabled.png"/>
343+
<Style.Triggers>
344+
<DataTrigger Binding="{Binding HasNext}" Value="True">
345+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/caret-right-default.png"/>
346+
</DataTrigger>
347+
</Style.Triggers>
348+
</Style>
349+
</Image.Style>
350+
</Image>
330351
</Grid>
331352
<ControlTemplate.Triggers>
332353
<Trigger Property="IsMouseOver"
@@ -360,15 +381,26 @@
360381
<Grid>
361382
<Border x:Name="DotsBackgroundBorder"
362383
Background="Transparent"
363-
CornerRadius="2" />
384+
CornerRadius="2"
385+
Width="36"/>
364386
<Image x:Name="DotsImage"
365-
Source="{Binding ConfirmSource}"
366-
Width="16px"
367-
Height="16px"
368-
Margin="5"
387+
Width="20px"
388+
Height="20px"
389+
Margin="3"
369390
HorizontalAlignment="Center"
370391
VerticalAlignment="Center"
371-
Stretch="UniformToFill" />
392+
Stretch="UniformToFill" >
393+
<Image.Style>
394+
<Style TargetType="Image">
395+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/check-disabled.png"/>
396+
<Style.Triggers>
397+
<DataTrigger Binding="{Binding ResultsLoaded}" Value="True">
398+
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/check.png"/>
399+
</DataTrigger>
400+
</Style.Triggers>
401+
</Style>
402+
</Image.Style>
403+
</Image>
372404
</Grid>
373405
<ControlTemplate.Triggers>
374406
<Trigger Property="IsMouseOver"
@@ -402,12 +434,13 @@
402434
<Grid>
403435
<Border x:Name="DotsBackgroundBorder"
404436
Background="Transparent"
405-
CornerRadius="2" />
437+
CornerRadius="2"
438+
Width="36"/>
406439
<Image x:Name="DotsImage"
407440
Source="/DynamoCoreWpf;component/UI/Images/whiteclosetab.png"
408-
Width="16px"
409-
Height="16px"
410-
Margin="5"
441+
Width="20px"
442+
Height="20px"
443+
Margin="3"
411444
HorizontalAlignment="Center"
412445
VerticalAlignment="Center"
413446
Stretch="UniformToFill" />
@@ -463,48 +496,6 @@
463496
</ToggleButton.Template>
464497
</ToggleButton>
465498
</Grid>
466-
<Button x:Name="btnDock"
467-
Click="DockButton_OnClick"
468-
Grid.Column="9"
469-
TabIndex="6">
470-
<Button.Style>
471-
<Style TargetType="{x:Type Button}">
472-
<Setter Property="Template">
473-
<Setter.Value>
474-
<ControlTemplate TargetType="{x:Type Button}">
475-
<Grid>
476-
<Border x:Name="DotsBackgroundBorder"
477-
Background="Transparent"
478-
CornerRadius="0,8,8,0" />
479-
<Image x:Name="DotsImage"
480-
Source="/DynamoCoreWpf;component/UI/Images/Dock_32px_default.png"
481-
Width="16px"
482-
Height="16px"
483-
Margin="8"
484-
HorizontalAlignment="Center"
485-
VerticalAlignment="Center"
486-
Stretch="UniformToFill" />
487-
</Grid>
488-
<ControlTemplate.Triggers>
489-
<Trigger Property="IsMouseOver"
490-
Value="True">
491-
<Setter TargetName="DotsBackgroundBorder"
492-
Property="Background"
493-
Value="{StaticResource DarkGreyBrush}" />
494-
</Trigger>
495-
<Trigger Property="IsMouseOver"
496-
Value="False">
497-
<Setter TargetName="DotsBackgroundBorder"
498-
Property="Background"
499-
Value="Transparent" />
500-
</Trigger>
501-
</ControlTemplate.Triggers>
502-
</ControlTemplate>
503-
</Setter.Value>
504-
</Setter>
505-
</Style>
506-
</Button.Style>
507-
</Button>
508499
</Grid>
509500
</Grid>
510501
</Grid>

0 commit comments

Comments
 (0)