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

Tab Control inside RIA DataForm

6 Answers 199 Views
TabControl
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 24 Aug 2009, 08:19 PM
I found a bug that only appears in certain combination (drove me crazy);

I have a MS ChildWindo wich has a RIA DataForm and I had placed a RADTab Control with three tabpages in it. And I had placed certain DataFields in Page 1 and page 2 and page 3. I was able to click OK to create new record and close the Window or Cancel to close without creating a new record. But I was able to close Child Window in either way.

Today, I was changing something else in Blend on the same DataForm and then from that point on, the program stop closing the Window.
If I would click on OK or Cancel, nothing happened. Then I tested with a quick "Double" click on OK or Cancel and I was able to exit. It seemed like the Tab control was intercepting my mouse click.

Then after lots of testing, I noticed in XAML code, the first Tab Item, the property "IsSelected" was set to "true". Which should be OK, but it's not. I removed it from XAML, and now the form closes.

I think you should look into this, because more people will use The DataForm and RADTab in the future.

6 Answers, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 25 Aug 2009, 01:36 PM
Hi Ben,

Unfortunately I was not able to reproduce the issue you are describing. Probably I am missing something. It would be great if you can provide me with your test project demonstrating the problem.

In my sample project I created a ChildWindow and added a DataForm controls in it. Then I added a RadTabControl in the EditTemplate of the DataForm. The RadTabControl has 3 RadTabItems. Each of the RadTabItems has a DataField as its content. Then I bound the DataForm to an ObservableCollection. Whiletesting I was able to add new records, delete existing records, cancel edit, close the child window, reopen the child window etc. I even marked one of my RadTabItems as IsSelected="True". Everything worked as expected.

I am attaching my sample project. Could you please take a look at it and let me know if I am missing something. Your feedback would be greatly appreciated.


Kind regards,
Kiril Stanoev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ben Hayat
Top achievements
Rank 2
answered on 25 Aug 2009, 03:47 PM
Ok Kiril, I can reproduce the problem with your project as well. I'll show the part of the code you need to change below in BOLD and you can see the problem:

        <df:DataForm x:Name="myDataForm" CancelButtonContent="Cancel" CommitButtonContent="Save" Header="My Data Form"

                     AutoEdit="True"
                     AutoCommit="True"
                     CommandButtonsVisibility="None">

            
            <df:DataForm.EditTemplate>
                <DataTemplate>
                    <telerikNavigation:RadTabControl>

                        <telerikNavigation:RadTabItem Header="Name" IsSelected="True"
                                HorizontalContentAlignment="Center"
                                VerticalContentAlignment="Center" >
.
.
.

If you remove the IsSelected="true" it will work. But I think the problem is because of the AutoEdit and AutoCommit.
Hope this helps!

[UPDATE]
Kiril, today I was talking to one of the SL PM at MS and I told him about this problem. He did say, that DataForm has some issues with Tab Control, even MS Tab Control. So before you spend too much time on this bug, this might be related to DataForm and not your tab control. I thought I let you know!
0
Accepted
Miroslav
Telerik team
answered on 31 Aug 2009, 07:59 AM
Hello Ben,

Thank you for reporting this issue. The problem seems to be on both sides -

When the OK button is clicked for some reason the content of the DataForm is recreated, i.e. the whole TabControl is recreated and new TabItems are added as well. The TabControl tries to focus the content it has just switched to. In this case when you put the IsSelected=True to the TabItem the TabControl will try to focus the content of that item. This happens in the wrong moment because it removes the focus from the button and the click never happens.

Here is part of the CallStack when this happens:

> Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.TryFocusContent() Line 2707 C#
  Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.UpdateSelectedContent(int newIndex = 1) Line 2618 + 0x8 bytes C#
  Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.OnSelectedIndexChanged(int oldIndex = -1, int newIndex = 1) Line 1533 + 0xb bytes C#
  Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.OnSelectedIndexChanged(System.Windows.DependencyObject sender = {Telerik.Windows.Controls.RadTabControl}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 2186 + 0x69 bytes C#
  Telerik.Windows.Controls!Telerik.Windows.PropertyMetadata.Create.AnonymousMethod(System.Windows.DependencyObject d = {Telerik.Windows.Controls.RadTabControl}, System.Windows.DependencyPropertyChangedEventArgs e = {System.Windows.DependencyPropertyChangedEventArgs}) Line 135 + 0x22 bytes C#
  [External Code] 
  Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.SelectedIndex.set(int value = 1) Line 982 + 0x34 bytes C#
  Telerik.Windows.Controls.Navigation!Telerik.Windows.Controls.RadTabControl.OnItemsChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e = {System.Collections.Specialized.NotifyCollectionChangedEventArgs}) Line 1688 + 0x42 bytes C#
  [External Code] 

There are two solutions to the problem - the DataForm stops recreating the contents on Click or we stop focusing the content automatically.

Certainly we need to do something about the focus because normally it is not an easy thing to deal with and there could be more problems in the future. 

I will reply here when we decide how to proceed with this.

All the best,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ben Hayat
Top achievements
Rank 2
answered on 31 Aug 2009, 01:34 PM
Hi Miro;

Thanks for the research; I think it would be helpful to MS team if you report your findings to them. The PM who owns DataForm and DataGrid is Scott Morison. Perhaps if you go to the Silverlight.Net forum under Toolkit and address this problem to Scott.

Thanks!
0
Miroslav
Telerik team
answered on 02 Sep 2009, 12:50 PM
Hello Ben,

Thanks for the suggestion, I created a new thread there with explanation of the problem.

http://betaforums.silverlight.net/forums/p/124630/280447.aspx

Best wishes,
Miroslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ben Hayat
Top achievements
Rank 2
answered on 02 Sep 2009, 01:38 PM
Great Miro; Hopefully the Toolkit team will see it and fix the problem.

Thanks for your cooperation!
Tags
TabControl
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Kiril Stanoev
Telerik team
Ben Hayat
Top achievements
Rank 2
Miroslav
Telerik team
Share this question
or