diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml
index 9dc9dd4a..fb487d1d 100644
--- a/v2rayN/v2rayN.Desktop/App.axaml
+++ b/v2rayN/v2rayN.Desktop/App.axaml
@@ -19,6 +19,7 @@
+
diff --git a/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.axaml b/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.axaml
new file mode 100644
index 00000000..97fec908
--- /dev/null
+++ b/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.axaml
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.cs b/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.cs
new file mode 100644
index 00000000..adb76063
--- /dev/null
+++ b/v2rayN/v2rayN.Desktop/Controls/AutoCompleteBox.cs
@@ -0,0 +1,38 @@
+using Avalonia.Input;
+using Avalonia.Interactivity;
+
+namespace v2rayN.Desktop.Controls;
+
+public class AutoCompleteBox : Avalonia.Controls.AutoCompleteBox
+{
+ static AutoCompleteBox()
+ {
+ MinimumPrefixLengthProperty.OverrideDefaultValue(0);
+ }
+
+ public AutoCompleteBox()
+ {
+ AddHandler(PointerPressedEvent, OnBoxPointerPressed, RoutingStrategies.Tunnel);
+ }
+
+ private void OnBoxPointerPressed(object? sender, PointerPressedEventArgs e)
+ {
+ if (Equals(sender, this) && e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
+ {
+ SetCurrentValue(IsDropDownOpenProperty, true);
+ }
+ }
+
+ protected override void OnGotFocus(GotFocusEventArgs e)
+ {
+ base.OnGotFocus(e);
+ if (IsDropDownOpen)
+ return;
+ SetCurrentValue(IsDropDownOpenProperty, true);
+ }
+
+ public void Clear()
+ {
+ SetCurrentValue(SelectedItemProperty, null);
+ }
+}
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
index b4a1a49e..5d5ec95e 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
@@ -2,6 +2,7 @@
x:Class="v2rayN.Desktop.Views.OptionSettingWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:ctrls="clr-namespace:v2rayN.Desktop.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
@@ -219,8 +220,7 @@
Grid.Row="13"
Grid.Column="1"
Width="200"
- Classes="Margin8"
- ToolTip.Tip="Level" />
+ Classes="Margin8" />
-
+ Width="300"
+ Classes="Margin8" />
-
-
-
+ Classes="Margin8" />
+ Classes="Margin8" />
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
index e45b58fe..e3e3cfef 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml.cs
@@ -74,18 +74,11 @@ namespace v2rayN.Desktop.Views
{
cmbSpeedTestTimeout.Items.Add(i * 5);
}
- Global.SpeedTestUrls.ForEach(it =>
- {
- cmbSpeedTestUrl.Items.Add(it);
- });
- Global.SpeedPingTestUrls.ForEach(it =>
- {
- cmbSpeedPingTestUrl.Items.Add(it);
- });
- Global.SubConvertUrls.ForEach(it =>
- {
- cmbSubConvertUrl.Items.Add(it);
- });
+
+ cmbSpeedTestUrl.ItemsSource = Global.SpeedTestUrls;
+ cmbSpeedPingTestUrl.ItemsSource = Global.SpeedPingTestUrls;
+ cmbSubConvertUrl.ItemsSource = Global.SubConvertUrls;
+
Global.GeoFilesSources.ForEach(it =>
{
cmbGetFilesSourceUrl.Items.Add(it);
@@ -139,12 +132,12 @@ namespace v2rayN.Desktop.Views
this.Bind(ViewModel, vm => vm.Hide2TrayWhenClose, v => v.togHide2TrayWhenClose.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
- this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.SelectedValue).DisposeWith(disposables);
+ this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.SelectedValue).DisposeWith(disposables);
- this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.SelectedValue).DisposeWith(disposables);
- this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.SelectedValue).DisposeWith(disposables);
+ this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
+ this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.MixedConcurrencyCount, v => v.cmbMixedConcurrencyCount.SelectedValue).DisposeWith(disposables);
- this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.SelectedValue).DisposeWith(disposables);
+ this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.MainGirdOrientation, v => v.cmbMainGirdOrientation.SelectedIndex).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.GeoFileSourceUrl, v => v.cmbGetFilesSourceUrl.SelectedValue).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SrsFileSourceUrl, v => v.cmbSrsFilesSourceUrl.SelectedValue).DisposeWith(disposables);
@@ -215,8 +208,9 @@ namespace v2rayN.Desktop.Views
private async Task InitSettingFont()
{
var lstFonts = await GetFonts();
- lstFonts.ForEach(it => { cmbcurrentFontFamily.Items.Add(it); });
- cmbcurrentFontFamily.Items.Add(string.Empty);
+
+ lstFonts.Add(string.Empty);
+ cmbcurrentFontFamily.ItemsSource = lstFonts;
}
private async Task> GetFonts()