This is a migrated thread and some comments may be shown as answers.

OnFocus event is looping endlessly

5 Answers 27 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 05 Jul 2010, 11:48 PM
I have a combo box in a grid and the onFocus event gets into an endless loop when I click on it.  I commented out all the code in that handler and it is still happening.  Here is the xaml for the box:

<

 

 

telerik:GridViewDataColumn Header="Matter">

 

 

 

 

<telerik:GridViewDataColumn.CellStyle>

 

 

 

 

<Style TargetType="telerik:GridViewCell">

 

 

 

 

<Setter Property="Template">

 

 

 

 

<Setter.Value>

 

 

 

 

<ControlTemplate TargetType="telerik:GridViewCell">

 

 

 

 

<telerik:RadComboBox Width="200" x:Name="radMatterCombo" GotFocus="RadMatterBox_GotFocus"

 

 

 

IsEditable="True" Text="Enter Matter Name/Number" />

 

 

 

 

</ControlTemplate>

 

 

 

 

</Setter.Value>

 

 

 

 

</Setter>

 

 

 

 

</Style>

 

 

 

 

</telerik:GridViewDataColumn.CellStyle>

 

 

 

 

</telerik:GridViewDataColumn>

and the handler:


 

 

 

private void RadMatterBox_GotFocus(object sender, RoutedEventArgs e)

 

{

 

 

//define the dropdown

 

 

 

 

 

 

 

//activebox = (sender as RadComboBox);

 

 

 

 

 

 

 

//activebox.Text = "";

 

 

 

 

 

 

 

//get the parent row

 

 

 

 

 

 

 

//var row = activebox.ParentOfType<GridViewRow>();

 

 

 

 

 

 

 

//string strClient = "";

 

 

 

 

 

 

 

//if (row != null)

 

 

 

 

 

 

 

// {

 

 

 

 

 

 

 

// var clicomb = row.ChildrenOfType<RadComboBox>().Where(c => c.Name == "radClientCombo").FirstOrDefault();

 

 

 

 

 

 

 

//strClient = clicomb.Text;

 

 

 

 

 

 

 

// }

 

 

 

 

 

 

 

//strip out just the number

 

 

 

 

 

 

 

//string[] arClient = new string[2];

 

 

 

 

 

 

 

//char[] splitter = {'|'};

 

 

 

 

 

 

 

//arClient = strClient.Split(splitter);

 

 

 

 

 

 

 

//strClient = arClient[0];

 

 

 

 

 

 

 

//wsSilverClient client = new wsSilverClient();

 

 

 

 

 

 

 

//client.LookupMattersCompleted += new EventHandler<LookupMattersCompletedEventArgs>(LookupMattersCompleted);

 

 

 

 

 

 

 

//client.LookupMattersAsync("", 10, strClient);

 

 

 

 

 

}

I'm pretty perlexed, I have another box in the grid which works fine with very similar code.  The other one actually had the same problem initually but it went away (I am not sure how I fixed it, seemed like I just deleted and re-added the vent handler and it worked.

5 Answers, 1 is accepted

Sort by
0
Kjell
Top achievements
Rank 1
answered on 06 Jul 2010, 01:16 AM
Actually I just noticed my other combobox is still doing the same thing, so both just loop all the time.
0
Kjell
Top achievements
Rank 1
answered on 06 Jul 2010, 05:32 PM
I tried putting another combo box outside of the grid and the same thing happens so the grid is not a factor.  I must be missing something really obvious here but silverlight/xaml is completely new to me. 
0
Kjell
Top achievements
Rank 1
answered on 07 Jul 2010, 05:04 AM
anyone?
0
Valeri Hristov
Telerik team
answered on 07 Jul 2010, 11:34 AM
Hello Kjell,

I was unable to reproduce the problem. Did you put a breakpoint in the OnGotFocus/OnLostFocus event handler? Such breakpoint could lead to the behavior you are seeing, because when it is hit, Visual Studio gets the focus, when you continue the application, RadComboBox gets the focus again, etc.

All the best,
Valeri Hristov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kjell
Top achievements
Rank 1
answered on 07 Jul 2010, 10:09 PM
You're right, the breakpoint was causing the loop,thank you.
Tags
ComboBox
Asked by
Kjell
Top achievements
Rank 1
Answers by
Kjell
Top achievements
Rank 1
Valeri Hristov
Telerik team
Share this question
or