Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
205
Setting Focus
posted

Hi Guyz,

 

I am not able to set the focus to another tabitem with in a TabControl. Some times focus works; but most of the time not working. The code is 

 

 private void dgClmPaymentScheduleInstallment_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            DependencyObject source = e.OriginalSource as DependencyObject;
            if (source == null)
                return;
            DataRecordPresenter drp = Infragistics.Windows.Utilities.GetAncestorFromType(source,
                    typeof(DataRecordPresenter), true) as DataRecordPresenter;
            if (drp == null)
                return;
            if (drp.Record != null)
            {
                drp.Record.IsSelected = true;
                drp.IsActive = true;
                DataRecord myRecord = drp.DataRecord;
                if (myRecord.ParentRecord == null)
                {
                    LoadDataForEditingPaymentTemplate();
                   // tabPaymentScheduleTemplate.Focus();
                    //Keyboard.Focus(tabPaymentScheduleTemplate);
                }
                else
                {
                    window.comPricingElementID = (int)myRecord.Cells["COMPricingElementID"].Value;
                    LoadDataForEditingPaymentSchedule(window.paymentInstallmentID);
                }
            }
        }

Most of the time any of the three focus codes not working. I tried all the three focus codes independently. 

What's wrong?

 Thanks

Asif Abdulla. A

Parents
No Data
Reply
  • 54937
    Offline posted

    If the element is in a tab that is not selected then those elements aren't in the visual tree. Maybe you should try calling BringIntoView on the element first and then calling focus on it.

Children
No Data