mirror of https://github.com/2dust/v2rayN
In the Desktop version, the information box uses SelectableTextBlock to replace TextBox
https://github.com/2dust/v2rayN/issues/7644pull/7732/head
parent
508eb24fc3
commit
610418b42b
|
@ -107,6 +107,7 @@ public class ThemeSettingViewModel : MyReactiveObject
|
||||||
x.OfType<Button>(),
|
x.OfType<Button>(),
|
||||||
x.OfType<TextBox>(),
|
x.OfType<TextBox>(),
|
||||||
x.OfType<TextBlock>(),
|
x.OfType<TextBlock>(),
|
||||||
|
x.OfType<SelectableTextBlock>(),
|
||||||
x.OfType<Menu>(),
|
x.OfType<Menu>(),
|
||||||
x.OfType<ContextMenu>(),
|
x.OfType<ContextMenu>(),
|
||||||
x.OfType<DataGridRow>(),
|
x.OfType<DataGridRow>(),
|
||||||
|
@ -146,6 +147,7 @@ public class ThemeSettingViewModel : MyReactiveObject
|
||||||
x.OfType<Button>(),
|
x.OfType<Button>(),
|
||||||
x.OfType<TextBox>(),
|
x.OfType<TextBox>(),
|
||||||
x.OfType<TextBlock>(),
|
x.OfType<TextBlock>(),
|
||||||
|
x.OfType<SelectableTextBlock>(),
|
||||||
x.OfType<Menu>(),
|
x.OfType<Menu>(),
|
||||||
x.OfType<ContextMenu>(),
|
x.OfType<ContextMenu>(),
|
||||||
x.OfType<DataGridRow>(),
|
x.OfType<DataGridRow>(),
|
||||||
|
|
|
@ -69,15 +69,15 @@
|
||||||
IsChecked="True"
|
IsChecked="True"
|
||||||
Theme="{DynamicResource SimpleToggleSwitch}" />
|
Theme="{DynamicResource SimpleToggleSwitch}" />
|
||||||
</WrapPanel>
|
</WrapPanel>
|
||||||
<TextBox
|
|
||||||
|
<ScrollViewer x:Name="msgScrollViewer" VerticalScrollBarVisibility="Auto">
|
||||||
|
<SelectableTextBlock
|
||||||
Name="txtMsg"
|
Name="txtMsg"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
BorderThickness="0"
|
|
||||||
Classes="TextArea"
|
Classes="TextArea"
|
||||||
IsReadOnly="True"
|
|
||||||
TextAlignment="Left"
|
TextAlignment="Left"
|
||||||
TextWrapping="Wrap">
|
TextWrapping="Wrap">
|
||||||
<TextBox.ContextMenu>
|
<SelectableTextBlock.ContextMenu>
|
||||||
<ContextMenu>
|
<ContextMenu>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuMsgViewSelectAll"
|
x:Name="menuMsgViewSelectAll"
|
||||||
|
@ -96,7 +96,8 @@
|
||||||
Click="menuMsgViewClear_Click"
|
Click="menuMsgViewClear_Click"
|
||||||
Header="{x:Static resx:ResUI.menuMsgViewClear}" />
|
Header="{x:Static resx:ResUI.menuMsgViewClear}" />
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</TextBox.ContextMenu>
|
</SelectableTextBlock.ContextMenu>
|
||||||
</TextBox>
|
</SelectableTextBlock>
|
||||||
|
</ScrollViewer>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Reactive.Disposables;
|
using System.Reactive.Disposables;
|
||||||
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
using Avalonia.ReactiveUI;
|
using Avalonia.ReactiveUI;
|
||||||
using Avalonia.Threading;
|
using Avalonia.Threading;
|
||||||
|
@ -9,9 +10,12 @@ namespace v2rayN.Desktop.Views;
|
||||||
|
|
||||||
public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||||
{
|
{
|
||||||
|
private readonly ScrollViewer _scrollViewer;
|
||||||
|
|
||||||
public MsgView()
|
public MsgView()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_scrollViewer = this.FindControl<ScrollViewer>("msgScrollViewer");
|
||||||
|
|
||||||
ViewModel = new MsgViewModel(UpdateViewHandler);
|
ViewModel = new MsgViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
|
@ -43,14 +47,14 @@ public partial class MsgView : ReactiveUserControl<MsgViewModel>
|
||||||
txtMsg.Text = msg.ToString();
|
txtMsg.Text = msg.ToString();
|
||||||
if (togScrollToEnd.IsChecked ?? true)
|
if (togScrollToEnd.IsChecked ?? true)
|
||||||
{
|
{
|
||||||
txtMsg.CaretIndex = int.MaxValue;
|
_scrollViewer?.ScrollToEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearMsg()
|
public void ClearMsg()
|
||||||
{
|
{
|
||||||
ViewModel?.ClearMsg();
|
ViewModel?.ClearMsg();
|
||||||
txtMsg.Clear();
|
txtMsg.Text = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuMsgViewSelectAll_Click(object? sender, RoutedEventArgs e)
|
private void menuMsgViewSelectAll_Click(object? sender, RoutedEventArgs e)
|
||||||
|
|
Loading…
Reference in New Issue