提交 58a2587e 编写于 作者: S shyamn

Fix a couple of regressions I introduced when I checked in my recent preview pane changes -

1. I had changed the preview pane service to just return the preview object that was passed in in cases where we have no additional information to display (e.g. in the case of refactorings, there is no diagnostic and so there is no need to add a diagnostic header). Unfortunately, the passed in object (IWpfDifferenceViewer) is not a wpf control that the platform can display - so this change ended up causing us to stop showing a preview in such cases. I changed the code back to do what it was doing before my change (i.e. get the visual control from from the passed in IWpfDifferenceViewer and wrap that with the preview pane). We'll need this later anyways once refactorings get headers...

2. In cases where header was absent, we were still displaying a spurious separator between non-existent header and the preview diff view. Changed the code to only display the separator when required. (changeset 1411804)
上级 9a78d283
......@@ -61,9 +61,9 @@
</Style>
</UserControl.Resources>
<DockPanel MinWidth="400">
<DockPanel Name="HeaderDockPanel" DockPanel.Dock="Top" Visibility="Collapsed"
MinWidth="{Binding ElementName=PreviewDockPanel, Path=ActualWidth}">
<FlowDocumentScrollViewer DockPanel.Dock="Top" Margin="3" MaxHeight="150" IsTabStop="True"
<StackPanel Name="HeaderStackPanel" DockPanel.Dock="Top" Visibility="Collapsed"
MinWidth="{Binding ElementName=PreviewDockPanel, Path=ActualWidth}">
<FlowDocumentScrollViewer Margin="3" MaxHeight="150" IsTabStop="True"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<FlowDocument PagePadding="0">
<Paragraph TextAlignment="Left"
......@@ -98,9 +98,9 @@
<Hyperlink Name="LearnMoreHyperlink" IsEnabled="False" RequestNavigate="LearnMoreHyperlink_RequestNavigate"/>
</TextBlock>
</DockPanel>
</DockPanel>
<Separator Name="HeaderSeparator" Margin="0" Visibility="Collapsed"/>
</StackPanel>
<DockPanel Name="PreviewDockPanel" DockPanel.Dock="Top" Visibility="Collapsed">
<Separator DockPanel.Dock="Top" Margin="0"/>
<ScrollViewer Name="PreviewScrollViewer" IsTabStop="True"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"/>
</DockPanel>
......
......@@ -34,7 +34,7 @@ internal partial class PreviewPane : UserControl, IDisposable
if ((severityIcon != null) && !string.IsNullOrWhiteSpace(id) && !string.IsNullOrWhiteSpace(title))
{
HeaderDockPanel.Visibility = Visibility.Visible;
HeaderStackPanel.Visibility = Visibility.Visible;
SeverityIconBorder.Child = severityIcon;
......@@ -92,6 +92,7 @@ private void InitializePreviewElement(object previewContent)
if (previewElement != null)
{
HeaderSeparator.Visibility = Visibility.Visible;
PreviewDockPanel.Visibility = Visibility.Visible;
PreviewScrollViewer.Content = previewElement;
previewElement.VerticalAlignment = VerticalAlignment.Top;
......@@ -159,12 +160,12 @@ public static Border GetPreviewForString(string previewContent, bool useItalicFo
// worth by default.
private void AdjustWidthAndHeight(FrameworkElement previewElement)
{
var headerDockPanelWidth = double.PositiveInfinity;
var headerStackPanelWidth = double.PositiveInfinity;
var titleTextBlockHeight = double.PositiveInfinity;
if (previewElement == null)
{
HeaderDockPanel.Measure(availableSize: s_infiniteSize);
headerDockPanelWidth = HeaderDockPanel.DesiredSize.Width;
HeaderStackPanel.Measure(availableSize: s_infiniteSize);
headerStackPanelWidth = HeaderStackPanel.DesiredSize.Width;
TitleTextBlock.Measure(availableSize: s_infiniteSize);
titleTextBlockHeight = TitleTextBlock.DesiredSize.Height;
......@@ -172,17 +173,17 @@ private void AdjustWidthAndHeight(FrameworkElement previewElement)
else
{
PreviewDockPanel.Measure(availableSize: new Size(previewElement.Width, double.PositiveInfinity));
headerDockPanelWidth = PreviewDockPanel.DesiredSize.Width;
if (IsNormal(headerDockPanelWidth))
headerStackPanelWidth = PreviewDockPanel.DesiredSize.Width;
if (IsNormal(headerStackPanelWidth))
{
TitleTextBlock.Measure(availableSize: new Size(headerDockPanelWidth, double.PositiveInfinity));
TitleTextBlock.Measure(availableSize: new Size(headerStackPanelWidth, double.PositiveInfinity));
titleTextBlockHeight = TitleTextBlock.DesiredSize.Height;
}
}
if (IsNormal(headerDockPanelWidth))
if (IsNormal(headerStackPanelWidth))
{
HeaderDockPanel.Width = headerDockPanelWidth;
HeaderStackPanel.Width = headerStackPanelWidth;
}
// If the pixel height required to render the complete title in the
......
......@@ -69,8 +69,8 @@ object IPreviewPaneService.GetPreviewPane(Diagnostic diagnostic, object previewC
if ((diagnostic == null) || (diagnostic.Descriptor is TriggerDiagnosticDescriptor))
{
// We don't have any additional info to display in the preview pane.
return previewContent;
return new PreviewPane(
null, null, null, null, null, null, telemetry, previewContent, _serviceProvider);
}
else
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册