Hi I have two questions.
1. I have a DockSite element. In this element I have some AutoHideLeftContainers. Here is a XAML code to demonstrate one of the ToolWindows:
<docking:DockSite.AutoHideLeftContainers>
<docking:ToolWindowContainer>
<docking:ToolWindow Title="{DynamicResource UnconfirmedAlarms}" TabIndex="4"
CanClose="False" HasOptions="False"
actiproFiles:ToolWindowTabFlashBehavior.IsFlashing="{Binding UnconfirmedAlarmIsFlashing}"
actiproFiles:ToolWindowTabFlashBehavior.IsStoppedWhenActivated="False">
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
<StackPanel Orientation="Vertical">
<ComboBox />
<ThemedDataGrid />
</StackPanel>
</ScrollViewer>
</DockPanel>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:DockSite.AutoHideLeftContainers>
Inside ThemedDataGrid we handle MouseLeftButtonUp event (we want to dock this toolWindow on mouseClick, if it is not docked). The code is :
public void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
var dg = sender as DataGrid;
if (null == dg) return;
var stackPanel = dg.Parent as StackPanel;
if (null != stackPanel)
{
var scrollViewer = stackPanel.Parent as ScrollViewer;
if (null != scrollViewer)
{
var dockPanel = scrollViewer.Parent as DockPanel;
if (null != dockPanel)
{
var toolWindow = dockPanel.Parent as ToolWindow;
if (null != toolWindow)
{
if(toolWindow.State != DockingWindowState.Docked)
toolWindow.Dock();
}
}
}
}
}
So far everything works. But if to click unpin button(right upper corner of toolWindow) this ToolWindow goes to the end of the list(we have more than 1 toolWindow) and we want it to be with fixed position. Pinning and unpinning form view works without changing toolWindow position. How can we unpin element without loosing it's position?
2. In the DockSite we have an opportunity to add DocumentItems:
<docking:DockSite viewModels:DockSiteViewModelBehavior.IsManaged="true" CanDocumentWindowsRaft="True" ItemContainerRetentionMode="Wrapped"
DocumentItemsSource="{Binding DocumentItems}" ToolItemsSource="{Binding ToolItems}">
and DocumentItem is:
<docking:DocumentWindow x:Class="Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
xmlns:views="http://schemas.actiprosoftware.com/winfx/xaml/views"
Title="{Binding Title}">
<Grid>
<views:AnimatedCanvas x:Name="AnimatedCanvasOfDocumentWindow" ZIndex="0"/>
</Grid>
</docking:DocumentWindow>
In my viewModel I want to add dynamically visual controls to AnimatedCanvas:
CustomAnimatedCanvas.Children.Add(userControl);
But it is placed always in the left upper corner. How can I set position to the control?
Thank you.
[Modified 10 years ago]