OnFocus event is looping endlessly

6 posts, 0 answers
  1. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 05 Jul 2010 Link to this post

    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.

  2. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 05 Jul 2010 Link to this post

    Actually I just noticed my other combobox is still doing the same thing, so both just loop all the time.
  3. DevCraft banner
  4. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 06 Jul 2010 Link to this post

    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. 
  5. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 07 Jul 2010 Link to this post

    anyone?
  6. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 07 Jul 2010 Link to this post

    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
  7. Kjell
    Kjell avatar
    276 posts
    Member since:
    Jun 2010

    Posted 07 Jul 2010 Link to this post

    You're right, the breakpoint was causing the loop,thank you.
Back to Top
DevCraft banner