System.Windows.RoutedEventArgs error

  • Thread starter Thread starter Alex. O. Koranteng
  • Start date Start date
A

Alex. O. Koranteng

I am getting the following error when I ran my SIlverlight Usercontrol
application.
It is failing at the event handler below

private void HandleGotFocus(object sender, RoutedEventArgs e)
{
var box = e.Source as TextBox;
if (box != null)
{
box.Select(0, box.Text.Length);
}
}

Also find below my codebehind file


using System;
using System.Collections.Generic;
using System.Linq;
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 UserControlDemo
{
public partial class AddressControl : UserControl
{
public AddressControl()
{
InitializeComponent();
}


private void HandleKeyDown(object sender, KeyEventArgs e)
{
Address address = null;
if (e.Key == Key.K && Keyboard.Modifiers == ModifierKeys.Control)
{
address = new Address()
{
Street1 = "1 Microsoft Way",
Street2 = "Building 10",
CityStateZip = "Redmond, WA 98052"
};
}
else if (e.Key == Key.U && Keyboard.Modifiers ==
ModifierKeys.Control)
{
address = new Address()
{
Street1 = "The Venetian",
Street2 = "3355 Las Vegas Boulevard South",
CityStateZip = "Las Vegas, NV 89109"
};
}
if (address != null)
this.DataContext = address;
}

Will appreciate any suggestions.
 
Hello Alex,

For this issue you raised is not ADO.NET related, to get better response,
would you mind posting it in ASP.NET newsgroup or Silverlight forum,
http://silverlight.net/forums/
http://www.microsoft.com/communities/newsgroups/en-us/?dg=microsoft.public.d
otnet.framework.aspnet

We will have Silverlight support engineer working on the issue with you
there. Thanks for your understadning! :-)

Best regards,
Colbert Zhou (colbertz @online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
 
Back
Top