make use of textblock instead of modifying MTB template
MODIFY
WalletWasabi.Gui/Controls/MultiTextBox.xaml
WalletWasabi.Gui/Controls/MultiTextBox.xaml
</ControlTemplate>
</Setter>
</Style>
- <Style Selector="controls|MultiTextBox[IsSelectable=False]">
- <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
- <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
- <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
- <Setter Property="Padding" Value="4" />
- <Setter Property="Template">
- <ControlTemplate>
- <Border Name="border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
- <DockPanel Margin="{TemplateBinding Padding}">
- <Grid>
- <Grid IsVisible="{TemplateBinding ClipboardNotificationVisible}">
- <Grid Opacity="{TemplateBinding ClipboardNotificationOpacity}">
- <Grid.Transitions>
- <DoubleTransition Property="Opacity" Easing="CircularEaseIn" Duration="0:0:0.5" />
- </Grid.Transitions>
- <TextBlock Text="Copied" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontWeight="Bold" />
- </Grid>
- </Grid>
- <TextBlock Name="floatingWatermark" Foreground="{DynamicResource ThemeAccentBrush}" FontSize="{DynamicResource FontSizeSmall}" Text="{TemplateBinding Watermark}" DockPanel.Dock="Top">
- <TextBlock.IsVisible>
- <MultiBinding Converter="{x:Static BoolConverters.And}">
- <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="UseFloatingWatermark" />
- <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Text" Converter="{x:Static StringConverters.IsNotNullOrEmpty}" />
- <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="ClipboardNotificationVisible" />
- </MultiBinding>
- </TextBlock.IsVisible>
- </TextBlock>
- <DataValidationErrors>
- <ScrollViewer
- HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
- VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}"
- IsVisible="{TemplateBinding TextVisible}">
- <Panel>
- <TextBlock Name="watermark" Opacity="0.5" Text="{TemplateBinding Watermark}" IsVisible="{TemplateBinding Text, Converter={x:Static StringConverters.IsNullOrEmpty}}" />
- <TextPresenter
- Name="PART_TextPresenter"
- Text="{TemplateBinding Text, Mode=TwoWay}"
- TextAlignment="{TemplateBinding TextAlignment}"
- TextWrapping="{TemplateBinding TextWrapping}"
- PasswordChar="{TemplateBinding PasswordChar}"
- CaretBrush="Transparent" />
- </Panel>
- </ScrollViewer>
- </DataValidationErrors>
- </Grid>
- </DockPanel>
- </Border>
- </ControlTemplate>
- </Setter>
- </Style>
<Style Selector="controls|MultiTextBox:pointerover /template/ Border#border">
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}" />
</Style>

MODIFY
WalletWasabi.Gui/Tabs/LegalDocumentsView.xaml
WalletWasabi.Gui/Tabs/LegalDocumentsView.xaml
<Grid ColumnDefinitions="*,320,*" DockPanel.Dock="Bottom">
<Button Command="{Binding AgreeClicked}" Grid.Column="1" Grid.ColumnSpan="1" IsVisible="{Binding !IsAgreed}" Margin="0,10,0,0">I Agree</Button>
</Grid>
- <controls:MultiTextBox Text="{Binding Text}" BorderBrush="{DynamicResource ThemeForegroundBrush}" IsReadOnly="True" IsSelectable="False" TextWrapping="Wrap" AcceptsReturn="True" />
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled">
+ <Panel>
+ <TextBlock Text="{Binding Text}" TextWrapping="Wrap"/>
+ <Panel.ContextMenu>
+ <ContextMenu>
+ <MenuItem Header="Copy Legal Text" Command="{Binding CopyLegalText}">
+ <MenuItem.Icon>
+ <DrawingPresenter HorizontalAlignment="Left" Height="16" Width="16" Stretch="Fill" Drawing="{StaticResource Copy}" />
+ </MenuItem.Icon>
+ </MenuItem>
+ </ContextMenu>
+ </Panel.ContextMenu>
+ </Panel>
+ </ScrollViewer>
</DockPanel>
</Grid>
</UserControl>

MODIFY
WalletWasabi.Gui/Tabs/LegalDocumentsViewModel.cs
WalletWasabi.Gui/Tabs/LegalDocumentsViewModel.cs
@@ -49,6 +49,8 @@ namespace WalletWasabi.Gui.Tabs
this.WhenAnyValue(x => x.Text)
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(text => EmptyContent = string.IsNullOrEmpty(text));
+
+ CopyLegalText = ReactiveCommand.CreateFromTask(async () => await Application.Current.Clipboard.SetTextAsync(Text));
}
public string FilePath { get; set; } = null;
@@ -68,6 +70,7 @@ namespace WalletWasabi.Gui.Tabs
}
public ReactiveCommand<Unit, Unit> AgreeClicked { get; }
+ public ReactiveCommand<Unit, Unit> CopyLegalText { get; }
public LegalDocuments LegalDoc { get; }
public bool IsAgreed { get; set; }

make use of textblock instead of modifying MTB template