Hi,
I having a hard time with ToolWindows. Let me explain. I have an application with autohide right and left containers. They are ToolWindows. And I create dynamically custom userControls(gauge elements). When custom userControl is created, I need set up it's properites. For that in a toolWindow on the right side I have property gird. Here is a code of right toolWindow with property grid in xaml:
<docking:DockSite.AutoHideRightContainers>
<docking:ToolWindowContainer x:Uid="ToolWindowAutoRight" docking:DockSite.ControlSize="300,300" x:Name="ToolWindowAutoRight">
<docking:ToolWindow x:Uid="ToolBoxEigenschaften" Title="{DynamicResource Eigenschaften}" ImageSource="/Resources\png\Toolbox16.png" x:Name="ToolBoxEigenschaften"
CanClose="False" HasOptions="False" >
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Dock="Right">
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Dock="Top" >
<Grid>
<Button Name="SaveBtn" Content=" Save " Command="{Binding SaveClickCommand}"/>
<Button Name="EditBtn" Content=" Edit " Command="{Binding EditClickCommand}"/>
<Button Name="CancelBtn" Content=" Cancel " Command="{Binding CancelClickCommand}"/>
</Grid>
</DockPanel>
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Dock="Bottom">
<shared:PixelSnapper x:Uid="shared:PixelSnapper_1" HorizontalRoundMode="Floor" VerticalRoundMode="Floor">
<propgrid:PropertyGrid x:Uid="PropertiesUserControl" x:Name="PropertiesUserControl" IsSummaryVisible="True" AreNestedCategoriesSupported="True"
IsEnabled="True" AreDefaultSortDescriptionsEnabled="False" IsReadOnly="{Binding IsReadOnly}"
AreCategoriesAutoExpanded="False" SelectedObject="{Binding SelectedObject}">
</propgrid:PropertyGrid>
</shared:PixelSnapper>
</DockPanel>
</DockPanel>
</docking:ToolWindow>
</docking:ToolWindowContainer>
</docking:DockSite.AutoHideRightContainers>
Untill now everything is working. When I have several userControls I want to navigate among them, and when userControl isSelected, if rigth side toolWindow is opened, I want to autoHide it. For this I have code in codeBehind :
C# private void OnHidePropertyGrid()
{
if (ToolBoxEigenschaften.CheckAccess())
{
ToolBoxEigenschaften.AutoHide(); //exception while executing this line
}
}
Now during execution of this code, I get - Exception: Caught: "EnumConverter cannot convert from (null)." (System.NotSupportedException) Exception Message = "EnumConverter cannot convert from (null).", Exception Type = "System.NotSupportedException", Exception WinRT Data = "" .
Why do I get this line and how can I fix it? This is first issue.
On the left side I also have several toolWindows.
They all are like this one:
<docking:ToolWindow x:Uid="ToolBoxAlarme" Title="{DynamicResource Alarme}" x:Name="ToolBoxAlarme"
CanClose="False" HasOptions="False" local:ToolWindowTabFlashBehavior.IsFlashing="{Binding AlarmIsFlashing}"
local:ToolWindowTabFlashBehavior.IsStoppedWhenActivated="False">
<DockPanel HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Dock="Top">
<ListBox x:Name="AlarmeListBox" IsSynchronizedWithCurrentItem="True" ItemsSource="{Binding ListAlarms}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</DockPanel>
</docking:ToolWindow>
Here ListAlarms it is an observableCollection of type <string>. And the issue is that when this toolWindow is Activated, after some period of time I get ArgumentOutOfRangeException "Index was out of range. Must be non-negative and less than the size of the collection." and my program terminates.
In debug mode CallStack is not pointing to code. So I would like to know, may be I implemented toolWindow in a wrong way and it is causing this error or it's somewhere else?
Thank you in advance.
[Modified 11 years ago]