Comments (9)
Is this really related to ursa or semi?
from avalonia.
Is this really related to ursa or semi?
Thank you for your response to the question!
This issue is not related to Semi or Ursa
After encountering this issue in my project, I listed all the components that may be related to the problem. Finally, I tested it on the website(https://play.avaloniaui.net/) and found that the issue is related to Avalonia, not Semi or Ursa
from avalonia.
maybe the same issue as #11665 ?
from avalonia.
maybe the same issue as #11665 ?
Yes, it's the same issue as # 11665, but there is currently no solution, which has a significant impact on the mobile phone project! If the issue cannot be resolved, the mobile project will be forced to pause.
from avalonia.
Feel free to debug it
from avalonia.
Closing as duplicate of #11665
@KevinYinHHU it doesn't help to open new issues for known ones. This doesn't speed up anything...
from avalonia.
Closing as duplicate of #11665
@KevinYinHHU it doesn't help to open new issues for known ones. This doesn't speed up anything...
Yes, a similar problem has already occurred, look forward to a solution.
from avalonia.
Feel free to debug it
Thanks.
from avalonia.
During my exploration of the Avalonia framework, I've encountered limitations in mobile browser environments that extend beyond just issues with TextBox controls; file open and save dialogues also fail to function properly. These challenges appear rooted in browser compatibility rather than any inherent design flaws in Avalonia itself. To address these difficulties, I've devised a temporary solution intended to offer guidance to others facing similar hurdles:
Overview of the Solution
In a browser context, Avalonia essentially behaves as a responsive Canvas component, not unlike other elements on a webpage. By leveraging the [JSImports] and [JSExports] mechanisms, we can invoke native input controls (such as Input or TextArea) to enhance Avalonia's functionality in a manner akin to building a conventional webpage. Although this method adds an extra layer of complexity potentially affecting user experience, it ensures that Avalonia remains usable in mobile browsers.
Implementation Details
Technological Choice: Given my limited expertise in frontend technologies, I opted for LayUI as a supporting tool. This is a lightweight front-end library that includes a variety of basic controls and has a compact size of approximately 350KB.
Custom AKBTextBox: I developed a custom control named AKBTextBox. When detected in a mobile browser environment, this control is set to read-only. By listening for the PointerReleased event, I trigger the layui.prompt dialog from LayUI, capturing user input and synchronizing it back to the AKBTextBox.
public class AKBTextBox : Avalonia.Controls.TextBox
{
protected override Type StyleKeyOverride => typeof(TextBox);
public AKBTextBox()
{
if (MainPanel.Current.IsMobile)
{
this.IsReadOnly = true;
this.PointerReleased += AKBTextBox_PointerReleased;
}
}
private async void AKBTextBox_PointerReleased(object? sender, Avalonia.Input.PointerReleasedEventArgs e)
{
if (OperatingSystem.IsBrowser())
{
string? result = null;
string title=this.Watermark?? "Please enter:";
if (this.AcceptsReturn)
{
result = await BrowserImports.PromptAsync(title, this.Text??"", 2);
}
else
{
result = await BrowserImports.PromptAsync(title, this.Text ?? "", 0);
}
if (result == null) return;
this.Text = result;
}
}
}
Efficacy Verification: Through a series of tests, this approach proved highly effective, achi
e1142e9bd85a4ccf1029ef31ce0216c6.mp4
eving the desired results.
Solution Expansion
Based on this logic, theoretically, we can call upon any native browser control to enrich the capabilities of Avalonia in mobile applications. This strategy isn't confined to text input but can be extended to a broader range of interactive scenarios, significantly enhancing the potential of Avalonia on mobile devices.
from avalonia.
Related Issues (20)
- Name table parsing is incorrect HOT 5
- Returning UnsetValue in IValueConverter.ConvertBack is reported as a binding error
- Clipboard does not copy/paste objects when complied with .Net8 HOT 7
- Unpredictable behavior with KeyFrames using the same KeyTime
- GetRealizedTreeContainers doesn't return all the TreeViewItem HOT 5
- Avalonia.Browser 11.1.0-beta2 test error
- ToggleSwitch : knob transitions should not remove when dragging is false.
- DrawingContext has a mess in state management in 11.1.0-rc2. HOT 1
- `AvaloniaRuntimeXamlLoader.Load` fails if `x:Class` contains private members
- `ContextMenu.PlacementTarget` is always `null` HOT 1
- `VirtualizingStackPanel` scrolls more than expected when receiving a `Reset` event.
- Missing methods for DrawingContext HOT 2
- Request to have Visual Tree as default in Avalonia DevTools HOT 1
- Acrylic Blur on windows 11 - while screen sharing.
- Null Tooltip displays a blank tooltip
- Avalonia should not call into the Runtime after the main thread has exited HOT 5
- Mouse-wheel scrolling does not work when cursor is on scroll bar
- `TextLeadingPrefixTrimming` with `Run`s trims incorrectly
- Lock screen password and biometric identification API HOT 2
- Border Rendering Issue Roll-up
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalonia.