Browse Source

Context actions UI: made checkboxes more lightweight.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@6417 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Martin Koníček 15 years ago
parent
commit
c2428e204d
  1. 135
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml

135
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsBulbControl.xaml

@ -11,6 +11,8 @@ @@ -11,6 +11,8 @@
<Geometry x:Key="DownArrowGeometry">M 0 0 L 2 3 L 4 0 Z</Geometry>
<local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<!-- Expander -->
<Style x:Key="ExpanderDownHeaderStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
@ -75,34 +77,34 @@ @@ -75,34 +77,34 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Expander}">
<DockPanel>
<ToggleButton x:Name="HeaderSite"
DockPanel.Dock="Top"
Margin="0"
MinWidth="0"
MinHeight="0"
Style="{StaticResource ExpanderDownHeaderStyle}"
IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStyle="{TemplateBinding FontStyle}"
FontStretch="{TemplateBinding FontStretch}"
FontWeight="{TemplateBinding FontWeight}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="ExpandSite"
DockPanel.Dock="Bottom"
Visibility="Collapsed"
Focusable="false"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</DockPanel>
<DockPanel>
<ToggleButton x:Name="HeaderSite"
DockPanel.Dock="Top"
Margin="0"
MinWidth="0"
MinHeight="0"
Style="{StaticResource ExpanderDownHeaderStyle}"
IsChecked="{Binding Path=IsExpanded,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
Content="{TemplateBinding Header}"
ContentTemplate="{TemplateBinding HeaderTemplate}"
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
Foreground="{TemplateBinding Foreground}"
Padding="{TemplateBinding Padding}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}"
FontStyle="{TemplateBinding FontStyle}"
FontStretch="{TemplateBinding FontStretch}"
FontWeight="{TemplateBinding FontWeight}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
<ContentPresenter x:Name="ExpandSite"
DockPanel.Dock="Bottom"
Visibility="Collapsed"
Focusable="false"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
</DockPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsExpanded"
Value="true">
@ -120,10 +122,69 @@ @@ -120,10 +122,69 @@
</Setter.Value>
</Setter>
</Style>
<!-- CheckBox -->
<SolidColorBrush x:Key="CheckBoxFillNormal"
Color="#F4F4F4"/>
<SolidColorBrush x:Key="CheckBoxStroke"
Color="#8E8F8F"/>
<Style
TargetType="{x:Type CheckBox}">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="Background"
Value="{StaticResource CheckBoxFillNormal}"/>
<Setter Property="BorderBrush"
Value="{StaticResource CheckBoxStroke}"/>
<Setter Property="BorderThickness"
Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<BulletDecorator Background="Transparent"
SnapsToDevicePixels="true">
<BulletDecorator.Bullet>
<Border Background="Transparent" Padding="4 2"> <!-- To make the CheckBox easier to hit by mouse -->
<aero:BulletChrome Background="Transparent"
BorderBrush="Transparent"
RenderMouseOver="false"
RenderPressed="false"
IsChecked="{TemplateBinding IsChecked}"/>
</Border>
</BulletDecorator.Bullet>
<ContentPresenter Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
RecognizesAccessKey="True"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</BulletDecorator>
<ControlTemplate.Triggers>
<Trigger Property="HasContent"
Value="true">
<Setter Property="Padding"
Value="4,0,0,0"/>
</Trigger>
<Trigger Property="IsEnabled"
Value="false">
<Setter Property="Foreground"
Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<!-- Visual tree -->
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
@ -175,23 +236,23 @@ @@ -175,23 +236,23 @@
<DataTemplate>
<DockPanel HorizontalAlignment="Stretch" LastChildFill="True">
<Image Source="{Binding Image}" Margin="3 2 4 2" DockPanel.Dock="Left" />
<!-- Command of every checkbox is the command on the main DataContext (ContextActionsBulbViewModel) -->
<!-- Command of every checkbox is the command on the main DataContext (ContextActionsBulbViewModel) -->
<CheckBox IsChecked="{Binding IsVisible}" VerticalAlignment="Center" DockPanel.Dock="Right"
Command="{Binding Path=DataContext.ActionVisibleChangedCommand,
RelativeSource={RelativeSource AncestorType={x:Type local:ContextActionsBulbControl}}}"
RelativeSource={RelativeSource AncestorType={x:Type local:ContextActionsBulbControl}}}"
CommandParameter="{Binding}"
Visibility="{Binding DataContext.IsHiddenActionsExpanded,
RelativeSource={RelativeSource AncestorType={x:Type local:ContextActionsBulbControl}},
Converter={StaticResource BoolToVisibilityConverter}}"
Click="CheckBox_Click"
Focusable="False">
Visibility="{Binding DataContext.IsHiddenActionsExpanded,
RelativeSource={RelativeSource AncestorType={x:Type local:ContextActionsBulbControl}},
Converter={StaticResource BoolToVisibilityConverter}}"
Click="CheckBox_Click"
Focusable="False">
</CheckBox>
<TextBlock Text="{Binding Name}" Margin="0 2 20 2" />
</DockPanel>
</DataTemplate>
</local:ContextActionsControl.ItemTemplate>
</local:ContextActionsControl>
<Expander x:Name="HiddenActionsExpander" Expanded="Expander_Expanded"
<Expander x:Name="HiddenActionsExpander" Expanded="Expander_Expanded"
IsExpanded="{Binding IsHiddenActionsExpanded}"
Grid.Row="2" Grid.Column="0" Margin="0">
<local:ContextActionsControl x:Name="HiddenActionsTreeView"
@ -205,7 +266,7 @@ @@ -205,7 +266,7 @@
RelativeSource={RelativeSource AncestorType={x:Type local:ContextActionsBulbControl}}}"
CommandParameter="{Binding}"
Click="CheckBox_Click"
Focusable="False"></CheckBox>
Focusable="False"></CheckBox>
<TextBlock Text="{Binding Name}" Margin="0 2 20 2" />
</DockPanel>
</DataTemplate>

Loading…
Cancel
Save