Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 8 additions & 19 deletions src/GitHub.VisualStudio/SharedDictionary.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,14 @@

<Style x:Key="VSStyledButton" TargetType="{x:Type Button}" BasedOn="{StaticResource VsButtonStyleKey}">
</Style>
<Style x:Key="VSStyledCheckBox" TargetType="{x:Type CheckBox}">
<Setter Property="Control.Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<CheckBox Foreground="{DynamicResource VsBrush.ToolWindowText}" Background="{DynamicResource VsBrush.ToolWindowBackground}">
<TextBlock TextWrapping="Wrap" Foreground="{DynamicResource VsBrush.ToolWindowText}" Background="{DynamicResource VsBrush.ToolWindowBackground}">
<TextBlock.Inlines>
<Run Text="{TemplateBinding Content}" />
</TextBlock.Inlines>
</TextBlock>
</CheckBox>
<ControlTemplate.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource VsBrush.ToolWindowBackground}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style x:Key="VSStyledCheckBox" BasedOn="{StaticResource VsCheckBoxStyleKey}" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{DynamicResource VsBrush.ToolWindowText}" />
<Setter Property="Background" Value="{DynamicResource VsBrush.ToolWindowBackground}" />
<Style.Triggers>
<Trigger Property="UIElement.IsMouseOver" Value="true">
<Setter Property="Background" Value="{DynamicResource VsBrush.ToolWindowBackground}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="VSStyledComboBox" TargetType="{x:Type ComboBox}" BasedOn="{StaticResource VsComboBoxStyleKey}">
</Style>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,24 @@

<CheckBox x:Name="makePrivate"
Margin="0,8,0,0"
Style="{StaticResource VSStyledCheckBox}">Private Repository</CheckBox>
Style="{StaticResource VSStyledCheckBox}">
<TextBlock TextWrapping="Wrap"
Foreground="{DynamicResource VsBrush.ToolWindowText}"
Background="{DynamicResource VsBrush.ToolWindowBackground}">
<TextBlock.Resources>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.5" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Resources>
<TextBlock.Inlines>
Copy link
Member

Choose a reason for hiding this comment

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

You can strip this back to just the literal Private Repository element - this will get rendered as an inline TextBlock and pick up the styling...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, right, I can move the trigger up to the checkbox

/me fixicates

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sigh, can't merge the TextBlock. If I do, then the Hover color in the checkbox (turning the square border a different color) also gets applied to the text. Which is something that the TE styles are not doing, it seems.

Copy link
Member

Choose a reason for hiding this comment

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

Uggghh 👍

<Run>Private Repository</Run>
</TextBlock.Inlines>
</TextBlock>
</CheckBox>

<Label x:Name="upgradeToMicroPlanWarning" HorizontalAlignment="Left" Visibility="Collapsed">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,7 @@ public RepositoryPublishControl()
d(this.Bind(ViewModel, vm => vm.RepositoryName, v => v.nameText.Text));

d(this.Bind(ViewModel, vm => vm.Description, v => v.description.Text));

d(this.WhenAnyValue(x => x.ViewModel.KeepPrivate)
.Subscribe(keepPrivate =>
{
// because we removed this.Bind, set this by hand
if (keepPrivate != makePrivate.IsChecked)
{
makePrivate.IsChecked = keepPrivate;
}
}));

// BEGIN DANGER ZONE
//
// This replaces the default Bind behaviour as the Checkbox control
// does not raise an event here when it is hosted in the Team Explorer
// view.
//
// We've used this.Bind in other places (popups) so it's something
// we need to investigate further
//
d(Observable.FromEventPattern<RoutedEventArgs>(makePrivate, "Checked")
.Subscribe(_ => ViewModel.KeepPrivate = true));
d(Observable.FromEventPattern<RoutedEventArgs>(makePrivate, "Unchecked")
.Subscribe(_ => ViewModel.KeepPrivate = false));
// END DANGER ZONE


d(this.Bind(ViewModel, vm => vm.KeepPrivate, v => v.makePrivate.IsChecked));
d(this.OneWayBind(ViewModel, vm => vm.CanKeepPrivate, v => v.makePrivate.IsEnabled));

//d(this.OneWayBind(ViewModel, vm => vm.ShowUpgradeToMicroPlanWarning, v => v.upgradeToMicroPlanWarning.Visibility));
Expand Down