Hi,
I have a XamDockManager, with some Tabbed Documents. Each ContentPane contains a UserControl. The problem I'm having is this; when one of my UserControls is the Active pane, and I try to open another ContentPane and call Activate, the new pane very briefly shows, but then the previous pane is reactivated.
What would cause a Tab to Activate on it's own? I'm only calling Activate in one place where I add a new ContentPane tabbed document.
Thanks
Andy
Activation is based around the input/keyboard focus of the wpf elements. The behavior you are describing sounds like focus is not shifting into the pane. I have seen two different scenarios that may lead to this. One is if the thing to receive focus was an HwndHost (including a Frame navigated to a web page, webbrowser, windowsformshost, addinhost, etc.). When an HwndHost receives focus it has to shift focus into its hwnd in which case there is no focusedelement (since focus is no longer within the wpf hwnd). This issue was reported recently and is addressed by the next hotfix. The other case is if the last element with focus within the pane was collapsed/hidden. In this case when the pane is activated it tries to focus the last focused element which in the case of a hidden/collapsed element ends up being a no-op so focus remained where it was. This too was reported recently and should be addressed in the next hotfix. In the interim, the second issue could be handled by explicitly focusing an element within the pane that is visible or possibly even the contentpane itself. In any case, you may want to submit the issue to the support group so you can be notified when the fix is available and to ensure that the scenario you are hitting is actually addressed by the fix.
Hmm... I'm not sure either of these is the case. I'm using Wpf controls only, and there should be something visible on the UserControl being displayed in the new pane. How can I confirm this?
This was all working before... I'm not sure what is causing this behavior, but it seems I can ONLY replicate it if the new pane is being created in response to a RoutedEvent raised by the UserControl which ends up "stealing" the focus back.
Any ideas?
Ok... I made a significant discovey here. I was thinking the control raising the event was the one stealing the focus back. It seems that the control being displayed in the NEW tab is somehow "refusing" to take focus and pushing it back to the previously active tab.
I dont' know if that makes a difference, but at least I can shift my focus to this other user control.
And of course if this does change things, I would like to know.
EDIT: I found the cause. On the user controls, I have another XamDockManager, which is setup like this:
<StackPanel DataContext="{StaticResource OrderData}"> <ToolBar> <Menu> <MenuItem CommandTarget="{Binding Path=CommandManager, BindsDirectlyToSource=True}" Command="ApplicationCommands.Save" Header="Save" > <MenuItem.Icon> <Image Source="{StaticResource Save16}" /> </MenuItem.Icon> </MenuItem> </Menu> </ToolBar> <igDm:XamDockManager FlyoutAnimation="Slide"> <igDm:XamDockManager.Panes> <igDm:SplitPane igDm:XamDockManager.InitialLocation="DockedRight" Width="200"> <igDm:ContentPane Header="Properites" AllowClose="False" IsPinned="False" AllowDocking="False" AllowFloatingOnly="False"> <StackPanel> <TextBlock Text="Created By:" /> <TextBox Text="{Binding Mode=OneWay, Path=CreatedBy}" IsReadOnly="True" /> <TextBlock Text="Created Date:" /> <TextBox Text="{Binding Mode=OneWay, Path=CreatedDate}" IsReadOnly="True" /> <TextBlock Text="Modified By:" /> <TextBox Text="{Binding Mode=OneWay, Path=ModifiedBy}" IsReadOnly="True" /> <TextBlock Text="Modified Date:" /> <TextBox Text="{Binding Mode=OneWay, Path=ModifiedDate}" IsReadOnly="True" /> </StackPanel> </igDm:ContentPane> </igDm:SplitPane> </igDm:XamDockManager.Panes> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="95" /> <ColumnDefinition Width="100" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="95" /> <ColumnDefinition Width="100" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="95" /> <ColumnDefinition Width="100" /> <ColumnDefinition Width="20" /> <ColumnDefinition Width="95" /> <ColumnDefinition Width="100" /> <ColumnDefinition Width="20" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition /> <RowDefinition Height="100" /> </Grid.RowDefinitions> </Grid> </igDm:XamDockManager> </StackPanel>
Now, this exact same arrangement works on the other user controls, but for some reason removing the XamDockManager xmal above causes the control to work correctly.
Is this one of the issues mentioned originally?
Well, I'm still at a loss on this. I can't create a sample which demonstrates the issue, but the only way to fix it is to remove the DockManager on the control which does not take focus.
Can you possibly make a copy of your application that has this issue and remove the unneeded aspects? If not and you can provide the application itself such that we can run it and see the issue then you could submit it to the support group and we can investigate it that way.
I'm working on getting something you could try,but it's difficult because there's a lot of code to change to make it work without the database. Would a video showing the problem help?
It can't hurt so you can certainly provide that but I suspect there won't be anything visually that would provide clues as to what is actually occurring.
I was able to par down my application enough to get a running sample. I'm currently awaiting permission, because the sample would include some of our assemblies. Every assembly provided though I do have the source code to as well, but I'm not sure if they would be relevent to the issue, which the possible exception of my wpf assembly.