Quantcast
Channel: Silverlight 5 forum
Viewing all articles
Browse latest Browse all 1083

Left right arrow keys don’t work in TextBox in Windowless mode

$
0
0

I have a .NET 4.5 WPF application  that hosts a WebBrowser control. WebBrowser loads a html page that contains a Silvelight5 application with Windowless property set to true. In Silverlight application there is a TextBox. The problem is that pressing left or right arrow keys when focus is on the TextBox, has no effect, the cursor doesn’t move among characters. If I change Windowless to false, arrow keys start working correctly in TextBox.

WPF Application
--------------------------
MainWindow.xaml
--------------------------<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     
        Title="MainWindow" Height="350" Width="525" FontFamily="Verdana"><Grid><Grid.RowDefinitions><RowDefinition Height="*" ></RowDefinition></Grid.RowDefinitions><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><WebBrowser Name="browser" ></WebBrowser></Grid></Window>

---------------------------
MainWindow.xaml.cs
---------------------------
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfApplication1
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();    
            browser.Navigate("http://localhost:49181/testwindowlesstrue.html#/MainPage.xaml");
        }
    }
}


-------------------------
Silverlight Application
-------------------------
MainPage.xaml
-------------------------
<UserControl x:Class="SilverlightApplication1.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" ><Grid><Grid.RowDefinitions><RowDefinition Height="*"/><RowDefinition Height="7*"/></Grid.RowDefinitions><TextBox Width="200" Height="30" Text="test"></TextBox></Grid></UserControl>

------------------------
MainPage.xaml.cs
------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightApplication1
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
    }
}

--------------------------------
testwindowlesstrue.html
--------------------------------
<html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" src="Silverlight.js"></script></head><body><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" style="width:100%;height:100%"><param name="source" value="ClientBin/SilverlightApplication1.xap" /><param name="onError" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="4.0.50401.0" /><param name="autoUpgrade" value="true" /><param name="onLoad" value="pluginLoaded" /><param name="windowless" value="true" /><param name="enablehtmlaccess" value =" true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=4.0.50401.0" style="text-decoration: none"><img src="http://go.microsoft.com/fwlink/?LinkId=161376" alt="Get Microsoft Silverlight" style="border-style: none" /></a></object></body></html>



Viewing all articles
Browse latest Browse all 1083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>