AutoHiding toolWindow causing exception

Docking/MDI for WPF Forum

Posted 6 years ago by Sasha
Version: 13.1.0590
Avatar

 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 6 years ago]

Comments (2)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Sasha,

I'm not sure what would cause those since we haven't seen it happen before.  Nothing stands out to me in the code snippets above.  Perhaps you could make a new very simple sample project that shows them happening and email that over to our support address?  Please reference this thread and rename the .zip file extension so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 6 years ago by Sasha
Avatar

Hi,

We  have fixed second issue. The problem was that with NET framework 4.5 and it's new functionality to access collections on non-UI Threads. And the first issue is not so critical yet. If we would not be able to fix it in future, I will send you sample project with this exception.

Thank for help.

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.