Skip to content

Commit 221135c

Browse files
committed
Created a common CopyTextToClipboard button style and fixed the alignment/margin of the button
1 parent 4c49020 commit 221135c

1 file changed

Lines changed: 57 additions & 92 deletions

File tree

src/DynamoCoreWpf/Views/Preview/InfoBubbleView.xaml

Lines changed: 57 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,39 @@
3434
To="0"
3535
Duration="0:0:.25" />
3636
</Storyboard>
37+
<Style x:Key="InfoBubbleCopyTextButtonStyle" TargetType="Button">
38+
<Setter Property="Margin" Value="0,0,0,0"/>
39+
<Setter Property="Width" Value="16"/>
40+
<Setter Property="Height" Value="16"/>
41+
<Setter Property="HorizontalAlignment" Value="Right"/>
42+
<Setter Property="VerticalAlignment" Value="Center"/>
43+
<Setter Property="ToolTip" Value="{x:Static p:Resources.CopyToClipboardTooltip}" />
44+
<Setter Property="Background" Value="Transparent"/>
45+
<Setter Property="BorderThickness" Value="0"/>
46+
<Setter Property="Template">
47+
<Setter.Value>
48+
<ControlTemplate TargetType="Button">
49+
<Grid>
50+
<Image x:Name="CopyIcon"
51+
Width="16" Height="16"
52+
Source="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png"/>
53+
</Grid>
54+
<ControlTemplate.Triggers>
55+
<Trigger Property="IsMouseOver" Value="False">
56+
<Setter TargetName="CopyIcon" Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png"/>
57+
</Trigger>
58+
<Trigger Property="IsMouseOver" Value="True">
59+
<Setter TargetName="CopyIcon" Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_hover.png"/>
60+
</Trigger>
61+
<Trigger Property="IsEnabled" Value="False">
62+
<Setter TargetName="CopyIcon" Property="Opacity" Value="0.5"/>
63+
</Trigger>
64+
</ControlTemplate.Triggers>
65+
</ControlTemplate>
66+
</Setter.Value>
67+
</Setter>
68+
</Style>
3769
</ResourceDictionary>
38-
3970
</UserControl.Resources>
4071
<Canvas x:Name="mainCanvas">
4172
<Grid x:Name="mainGrid" Margin="10">
@@ -128,36 +159,14 @@
128159
Text="{x:Static p:Resources.InfoBubbleError}"
129160
Visibility="{Binding NodeErrorsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
130161
<!-- Copy to Clipboard Button -->
131-
<Button Name="ErrorCopyToClipboardButton"
132-
Grid.Row="0"
133-
Grid.Column="2"
134-
Width="16"
135-
Height="16"
136-
Margin="0,0,10,0"
137-
HorizontalAlignment="Right"
138-
VerticalAlignment="Center"
139-
BorderThickness="0"
140-
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyToClipboardCommand}"
141-
CommandParameter="{Binding NodeErrorsToDisplay[0]}"
142-
Visibility="{Binding NodeErrorsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
143-
<Button.ToolTip>
144-
<ToolTip Content="{x:Static p:Resources.CopyToClipboardTooltip}" Style="{StaticResource GenericToolTipLight}" />
145-
</Button.ToolTip>
146-
<Image Width="16" Height="16" >
147-
<Image.Style>
148-
<Style TargetType="{x:Type Image}">
149-
<Style.Triggers>
150-
<Trigger Property="IsMouseOver" Value="False">
151-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png" />
152-
</Trigger>
153-
<Trigger Property="IsMouseOver" Value="True">
154-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_hover.png" />
155-
</Trigger>
156-
</Style.Triggers>
157-
</Style>
158-
</Image.Style>
159-
</Image>
160-
</Button>
162+
<Button
163+
Grid.Row="0"
164+
Grid.Column="2"
165+
Visibility="{Binding NodeErrorsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
166+
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
167+
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
168+
CommandParameter="{Binding NodeErrorsToDisplay[0]}"
169+
/>
161170
</Grid>
162171
<!-- Error Info -->
163172
<ScrollViewer Grid.Row="1"
@@ -398,36 +407,14 @@
398407
Text="{x:Static p:Resources.InfoBubbleWarning}"
399408
Visibility="{Binding NodeWarningsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
400409
<!-- Copy to Clipboard Button -->
401-
<Button Name="WarningCopyToClipboardButton"
402-
Grid.Row="0"
403-
Grid.Column="2"
404-
Width="16"
405-
Height="16"
406-
Margin="0,0,10,0"
407-
HorizontalAlignment="Right"
408-
VerticalAlignment="Center"
409-
BorderThickness="0"
410-
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyToClipboardCommand}"
411-
CommandParameter="{Binding NodeWarningsToDisplay[0]}"
412-
Visibility="{Binding NodeWarningsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
413-
<Button.ToolTip>
414-
<ToolTip Content="{x:Static p:Resources.CopyToClipboardTooltip}" Style="{StaticResource GenericToolTipLight}" />
415-
</Button.ToolTip>
416-
<Image Width="16" Height="16" >
417-
<Image.Style>
418-
<Style TargetType="{x:Type Image}">
419-
<Style.Triggers>
420-
<Trigger Property="IsMouseOver" Value="False">
421-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png" />
422-
</Trigger>
423-
<Trigger Property="IsMouseOver" Value="True">
424-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_hover.png" />
425-
</Trigger>
426-
</Style.Triggers>
427-
</Style>
428-
</Image.Style>
429-
</Image>
430-
</Button>
410+
<Button
411+
Grid.Row="0"
412+
Grid.Column="2"
413+
Visibility="{Binding NodeWarningsSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
414+
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
415+
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
416+
CommandParameter="{Binding NodeWarningsToDisplay[0]}"
417+
/>
431418
</Grid>
432419

433420
<!-- Warning Info -->
@@ -716,40 +703,18 @@
716703
Text="{x:Static p:Resources.InfoBubbleInfo}"
717704
Visibility="{Binding NodeInfoSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />
718705
<!-- Copy to Clipboard Button -->
719-
<Button Name="InfoCopyToClipboardButton"
720-
Grid.Row="0"
721-
Grid.Column="2"
722-
Width="16"
723-
Height="16"
724-
Margin="0,0,10,0"
725-
HorizontalAlignment="Right"
726-
VerticalAlignment="Center"
727-
BorderThickness="0"
728-
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyToClipboardCommand}"
729-
CommandParameter="{Binding NodeInfoToDisplay[0]}"
730-
Visibility="{Binding NodeInfoSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}">
731-
<Button.ToolTip>
732-
<ToolTip Content="{x:Static p:Resources.CopyToClipboardTooltip}" Style="{StaticResource GenericToolTipLight}" />
733-
</Button.ToolTip>
734-
<Image Width="16" Height="16" >
735-
<Image.Style>
736-
<Style TargetType="{x:Type Image}">
737-
<Style.Triggers>
738-
<Trigger Property="IsMouseOver" Value="False">
739-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_default.png" />
740-
</Trigger>
741-
<Trigger Property="IsMouseOver" Value="True">
742-
<Setter Property="Source" Value="/DynamoCoreWpf;component/UI/Images/copy_16px_hover.png" />
743-
</Trigger>
744-
</Style.Triggers>
745-
</Style>
746-
</Image.Style>
747-
</Image>
748-
</Button>
706+
<Button
707+
Grid.Row="0"
708+
Grid.Column="2"
709+
Visibility="{Binding NodeInfoSectionExpanded, FallbackValue=Collapsed, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}"
710+
Style="{StaticResource InfoBubbleCopyTextButtonStyle}"
711+
Command="{Binding ElementName=InfoBubbleWindowUserControl, Path=DataContext.CopyTextToClipboardCommand}"
712+
CommandParameter="{Binding NodeInfoToDisplay[0]}"
713+
/>
749714
</Grid>
750715
<!-- Info Info -->
751716
<ScrollViewer Grid.Row="1"
752-
MaxHeight="200"
717+
MaxHeight="200"
753718
PreviewMouseWheel="ScrollViewer_PreviewMouseWheel"
754719
VerticalScrollBarVisibility="Auto">
755720
<ListBox Margin="0,5,0,0"

0 commit comments

Comments
 (0)