Hello,
I need to change ContentPane's header when it's minimized. Is there any event for ContentPane's minimizing?
Thanks.
Hello Alexey,
Thank you for your post. I have been looking into it, but I am not sure that I fully understand your requirement, so could you please be more specific what do you mean by “ContentPane's minimizing”, because the pane cannot be minimized as a Window for example. It will be great if you send us screenshots of the two states, so we could be able to investigate this further for you.
Looking forward for your reply.
Thank you for reply, Stefan. You are right, as far as I understand, PaneToolWindow is really minimized, not ContentPane. I made the screenshot from Infragistics examples. How can I define that the window has just minimized?
Hello Stefan,
Thank you for your reply. Unfortunately, I had no time to get this worked till this moment because of other tasks. But I can return to this suspended issue now. I'm still can't understand clearly the role of UnpinnedTabFlyout here. Can I just define IsVisibleChanged event handler to manage with this situation?
The UnpinnedTabFlyout is the element that contains the ContentPane and its visibility is changed. This is why I used it. The sample I shared with you is just a guideline, which you can use. If want to use another approach, please feel free to modify it, so it cover your requirements.
I can't understand the basic and most important moment here... When should UnpinnedTabFlyout_Loaded event handler work in your example? Even Visual Studio shows that this method is never used.
The Loaded event of UnpinnedTabFlyout element fires, when the ContentPane is "Auto Hide". If put a breakpoint and run the sample and set the Pane to be auto hided, you will notice that the event fires.
Thank you for reply. Now I understand that UnpinnedTabFlyout_Loaded fires for all content panes if I just set the appropriate style before the description of XamDockManager.
But I still have some difficulties in understanding how it works. I run your example, press Auto Hide, UnpinnedTabFlyout_Loaded fires, then MainWindow_IsVisibleChanged fires(e.OldValue = true, e.NewValue = false), then I put the cursor on the header, MainWindow_IsVisibleChanged fires again(e.OldValue = false, e.NewValue = true), then I press Auto Hide to switch off 'Auto Hide' mode, MainWindow_IsVisibleChanged fires again(e.OldValue = true, e.NewValue = false). Why do e.NewValue and e.OldValue have such values? As far as I understand, the window should be hidden, according to them.
When I repeat these actions one more time I have MainWindow_IsVisibleChanged fired for two times after pressing Auto Hide to switch on 'Auto Hide' mode(1.e.OldValue = false, e.NewValue = true, 2.e.OldValue = true, e.NewValue = false). Why?
And it works strange for my working project where I want to add this functionality.
<Grid Grid.Row="2" >
<Grid.Resources> <Style TargetType="{x:Type igDock:UnpinnedTabFlyout}"> <EventSetter Event="Loaded" Handler="UnpinnedTabFlyout_Loaded"/> </Style> </Grid.Resources>
<DockManager:XamDockManager x:Name="dockingManager" ActivePaneChanged="dockingManager_ActivePaneChanged" AllowMaximizeFloatingWindows="True" AllowMinimizeFloatingWindows="True" ToolWindowLoaded="dockingManager_ToolWindowLoaded" UseLayoutRounding="False"> <DockManager:XamDockManager.Panes> <DockManager:SplitPane x:Name="ToolBoxSplitPane" DockManager:XamDockManager.InitialLocation="DockedBottom" Height="200" > <DockManager:ContentPane AllowInDocumentHost="False" x:Name="ToolBoxContentPane" Header="{lex:LocText Key=trading, Dict=Strings, Assembly=StringsResources}" Visibility="{Binding ViewModel.ShowToolBox, Mode=TwoWay, Converter={StaticResource BoolToVisibilityConverter}}">
...
</DockManager:ContentPane> </DockManager:SplitPane>
</DockManager:XamDockManager.Panes>
</DockManager:XamDockManager></Grid>
I see that MainWindow_IsVisibleChanged fires several times for every action and UnpinnedTabFlyout_Loaded fires after several calls of MainWindow_IsVisibleChanged. e.NewValue and e.OldValue has values, that don't correspond to the current state of the window. And these all calls are for 'trading' ContentPane described above.
The issue you are describing is exactly the same that the control would have because the toolwindow can be shown when the mouse is over the panetabitem so if you're going to change the header to something shorter then the header wouldn't necessarily be visible any more. Perhaps what you need to do is have both headers present and then selectively show one and mark the other hidden (not collapsed) so that it still occupies the same extent it would if the longer header were still visible.
e.g. The following is a pane that shows the Header by default. When the pane is unpinned it will be as wide as the wider of the 2 texts and it will show the alternate text (stored in the Tag) when the content is not visible to the end user.
<igWpf:ContentPane Header="Header" Tag="Header (plus stuff)"> <igWpf:ContentPane.TabHeaderTemplate> <DataTemplate> <Grid> <TextBlock x:Name="short" Text="{Binding}" /> <TextBlock x:Name="long" TextAlignment="Center" Text="" Visibility="Collapsed" /> </Grid> <DataTemplate.Triggers> <Trigger Property="igWpf:XamDockManager.PaneLocation" Value="Unpinned"> <Setter TargetName="long" Property="Text" Value="{Binding RelativeSource={RelativeSource AncestorType={x:Type igWpf:PaneTabItem}}, Path=Pane.Tag}" /> <Setter TargetName="short" Property="TextAlignment" Value="Center" /> </Trigger> <!-- when the pane is unpinned and the content is visible then we want to make sure the alternate header is hidden so the tab can be wider if needed--> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type igWpf:PaneTabItem}}, Path=Pane.IsHitTestVisible}" Value="True" /> <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(igWpf:XamDockManager.PaneLocation)}" Value="Unpinned" /> </MultiDataTrigger.Conditions> <Setter TargetName="long" Property="Visibility" Value="Hidden" /> </MultiDataTrigger> <!-- when the pane is unpinned and the content is not visible then show the longer header (but make the other hidden in case it happens to be wider)--> <MultiDataTrigger> <MultiDataTrigger.Conditions> <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type igWpf:PaneTabItem}}, Path=Pane.IsHitTestVisible}" Value="False" /> <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(igWpf:XamDockManager.PaneLocation)}" Value="Unpinned" /> </MultiDataTrigger.Conditions> <Setter TargetName="short" Property="Visibility" Value="Hidden" /> <Setter TargetName="long" Property="Visibility" Value="Visible" /> </MultiDataTrigger> </DataTemplate.Triggers> </DataTemplate> </igWpf:ContentPane.TabHeaderTemplate></igWpf:ContentPane>
The idea was created: http://ideas.infragistics.com/forums/192363-wpf/suggestions/6600174-panetoolwindow-s-minimize-and-maximize-restore-ev . And I added the comment for it on Friday. It has 'Under review' status and I think it's worth to wait if it's implemented, because using events and flags make the issue too complicated.
As I said before, there isn't an event which you can use and this is why I suggested you logging a product idea here:
http://ideas.infragistics.com/
The other thing you can do is use the events I suggested you and use boolean flags, because as you noticed the events fire more times than you need.
Hope this helps you.
I think it becomes too complicated. First of all, I want to remind what I want to do. I want to set ContentPane's header to 'header' when PaneToolWindow is shown and to 'header (additional info)' when it's hidden in 'Auto Hide' mode.
Using UnpinnedTabFlyout, MouseOver(or MouseEnter) and MouseLeave for PaneTabItem can't help me in implementation, because when MouseOver fires for the long header('header (additional info)'), it becomes the short header('header')(because PaneToolWindow is shown) and MouseLeave fires at once(the opposite situation is actual, when MouseLeave fires for the short header, it becomes the long header(because PaneToolWindow is hidden) and MouseOver fires at once). I can even see the infinite loop of MouseOver and MouseLeave events with infinite header's blinking.
I just need a sign that will definitely notify that PaneToolWindow is shown or hidden.
The behavior you described is expected, because the when you press the AutoHide button in order to pin the ContentPane the UnpinnedTabFlyout element is no longer visible. The same thing happens when you make the ContentPane AutoHidden. In order to achieve the functionality you want you will have to handle some of the cases and add "if" statements. You can also use the PaneTabItem element, which is the Tab, when the Pane is AutoHidden. You can handle its MouseOver or MouseLeftButtonDown events to help you achieve the functionality you want.