I am trying to make an alternative browser for Windows Phone 8 and would like to have the same keyboard open for my textbox as the one used by the native browser. The one with the .com button as well as the arrow where the enter button is. I am guessing this is probably some simple setting but I have no idea what it is.
Use InputScope property in the TextBox, take a look to this samples in msdn.
For example:
<TextBox Name="txtPhoneNumber" Height="71" Width="460" >
<TextBox.InputScope>
<InputScope>
<InputScopeName NameValue="Number" />
</InputScope>
</TextBox.InputScope>
</TextBox>
You're looking for the URL input scope. See more here: InputScopeNameValue
Related
In WPF application the WebBrowser control doesn't render external html url properly.
While source assigned with external url, page get loaded.
But html hover effects & svg animations are not working.
Stuck at this point (VisualStudio 2015 environment).
Help me to step up.
Thanks in advance.
<StackPanel>
<WebBrowser Source="https://www.amcharts.com/demos/simple-pie-chart/"
OverridesDefaultStyle="False" MaxHeight="500"/>
</StackPanel>
If I understand correctly, you can not modify the HTML content of the web page.
You can use the following trick instead:
In registry:
Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION for 64-bit or 32-bit only machines.
Create a new DWORD key, and name it the name of your application e.g. "myapp.exe" and then edit the value of the key. There are many different values you can add depending on the IE version you want to emulate. I entered 11001 (as a decimal value - 0x2AF9 in HEX) which emulates IE 11 (many more values located at: http://msdn.microsoft.com/en-us/library/ee330730%28v=vs.85%29.aspx#browser_emulation).
Solution at the end.
I have a hard time finding informations about a youtubeplayer in uwp following the MVVM pattern.
What are the differences between <MediaElement> and <WebView> in this context and what would be better/easier to use?
How do I handle the events of the Player in my VM?
VS2017 tells me that i can't use the MediaPlayerElement
Error Message
I tried other versions/builds of VS2017 but get the same error.
Are there other ways to do this?
TY
Edit:
<WebView> seems to be pretty easy. Are there any downsides using it?
<WebView x:Name="webView" Width="300"
Height="225" Source="https://www.youtube.com/watch?v=2Rg1XmzzrTM"
RelativePanel.AlignHorizontalCenterWithPanel="True"
RelativePanel.Below="linkYT"/>
Edit2:
Thanks to Aditya Sharma I got on the right Track and found this Question
So I ended up with the following:
View:
<MediaElement x:Name="ytPlayer"
AreTransportControlsEnabled="True"
Source="{Binding Test1, Mode=OneWay}"
Width="600"
AutoPlay="True"
Height="400"/>
VM:
public void doSomething()
{
...
test1 = new Uri(convertLink(currentMovie.TrailerSource));
...
}
private string convertLink(string link)
{
IEnumerable<VideoInfo> videoInfos = DownloadUrlResolver.GetDownloadUrls(link, false);
VideoInfo video = videoInfos
.First(info => info.VideoType == VideoType.Mp4 && info.Resolution == 720
);
return video.DownloadUrl;
}
Where Test1 is of Type Uri and currentMovie.TrailerSource is a string
For this to work I had to get the NuGet YouTubeExtractor.
Hope this Helps somebody get it done MVVM.
So here is the thing, We have 1. WebView and 2. MediaElement
Let's take up a deep dive into these:
WebView: is basically a phone in app browser. you can give it a link and it'll navigate to the webPage. You can use it for your youtube screening but there will be downsides:
You won't be able to use native controls like pause/play/seek locally. All the controls will be handled by the website rendered in a WebView.
You have no control on the UI as well. You'll see the basic embedded youtube UI in your app WebView that might just break your UI and might also just provide a pixelated view when scaled.
MediaElement on the other hand is quite convenient, it has a source property that takes a Uri datatype as well so the great thing is that you can pass in your Uri as the embedded link for the youtube vid, the MediaElement will handle everything for you plus, it'll give you some additional advantages like control over your UI, Play/Pause or even custom styling and autoplay/playRate options.
So In my opinion, I would say use a MediaElement over the webView as it'll provide you with more control over whats happening and also provide a native experience to the user.
You can find some more information on it here
in this question and in it's comments section.
Also, since you'll be using mvvm on windows 10, I would recommend you x:bind the Source property of the MediaElement to a Uri DataType property in a oneWay Mode in your ViewModel
the following custom control ToggleButton is not capable of InvokePattern.
<ToggleButton Click="click_event"
... />
What can I do to execute the ToggleButton's click-event over some UIA-Pattern??
This link provides information about AutomationPeer & custom controls. But it seems like I need to change the application under test (AUT) to use this customized AutomationPeer?!
Guideline if you are allowed to change the AUT
Toggle buttons don't support InvokePattern, but they do support TogglePattern. You shouldn't need to dive into the automation peers at all.
I have a aspx page. By default, when the page loads the focus is on first textbox. I want to remove the focus to nothing. I am developing this website for a mobile device.
We have come to this nothing conclusion due to some cross browser restrictions we faced with IE.
Page.Focus(); in the init is not working and I don't want to set up the focus to anything.
This information is all I have. Hope it is sufficient for possible resolution.
I will appreciate your feedback and time spend on this query...
An alternative can be to create a hidden control and move the focus to that control
If you're able to use jQuery why don't you do
$('#idOfInputWhichKeepsOnGettingFocus').blur();
If not, create a new first field
<input id="youCannotSeeMe" style="position:absolute; left:9001px;" />
This works:
Page.SetFocus(this);
I'm developing wp8 application for reading Twitter. I read, that RichTextBox can detect links, it's good. But, I want to make next functionality: if in tweet text exist symbol "#" - make a hyperlink with world after "#", which will open a new page like /DetailsPage.xaml?name=#name and show additional info about user. The same thing with #, but open page with tweets which has this hashtag. Is there any way to make it?
Very simple, use the following XAML:
<RichTextBox>
<Paragraph>
<Hyperlink NavigateUri="/Page1.xaml">click me!</Hyperlink>
</Paragraph>
</RichTextBox>
This will display text click me! which looks like a hyperlink and can be clicked. When clicked, it will take you to Page1.xaml in your project.
You will obviously need to create content dynamically for RichTextBox, but I will leave it as an exercise.