fix(editor): the preview tools take the editor from their viewport, not by element name

The viewport presents its tools outside the view's logical tree, where the
EditorRoot name may not resolve: the row then lost its data context, so the crop
result toggle showed without a tooltip and Compare lost its state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-07 10:30:25 +00:00
1 parent c5c4f9adfe
commit c5a01c1290
1 file changed
+6 -2
+6 -2
View File
@@ -124,8 +124,12 @@
CropMaskMode="{Binding CropMaskMode}" InfoText="{Binding InfoText}" ToolTip="{l:Loc Tooltips.Editor.Preview.View}"
AutomationProperties.Name="{l:Loc Editor.Preview}" SizeChanged="OnPreviewSizeChanged">
<v:PreviewViewport.ToolsContent>
<!-- Tools give the keyboard back to the preview after a click, so Space keeps playing (OnToolClicked). -->
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, ElementName=EditorRoot}" ButtonBase.Click="OnToolClicked">
<!--
Tools give the keyboard back to the preview after a click, so Space keeps playing (OnToolClicked). The viewport
presents them outside the view's logical tree, so they take the editor from the viewport they sit in.
-->
<StackPanel Orientation="Horizontal" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=v:PreviewViewport}}"
ButtonBase.Click="OnToolClicked">
<ToggleButton Style="{StaticResource ToggleButton.PreviewTool}" IsChecked="{Binding IsCompare}" ui:ButtonIcon.Glyph="{StaticResource Icon.Compare}"
Content="{l:Loc Editor.Preview.Compare}" ToolTip="{l:Loc Tooltips.Editor.Preview.Compare}" />
<ToggleButton Visibility="{Binding IsExportTab, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" Style="{StaticResource ToggleButton.PreviewTool}"