'System.Windows.Media.SolidColorBrush' must have IsFrozen set to false

Docking/MDI for WPF Forum

Posted 7 years ago by Billy Jacobs
Version: 11.1.0545
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
Avatar

I have am using a DockPanel. It has a tool window container on the left and on the right and and MDI container in the middle. The tabs and windows that populate these 3 containers are generated dynamically.

It does not happen on a predictable basis but many times when I click on one of the auto hide tabs of the tool window to expand the tab, the program crashes with the following error:

Specified value of type 'System.Windows.Media.SolidColorBrush' must have IsFrozen set to false to modify.

Here is the xaml for the window.

 

            <DockPanel Margin="2,2,2,2" SnapsToDevicePixels="True">
                <DockPanel.Resources>
                    <converters:BooleanVisibilityConverter x:Key="BooleanVisibilityConverter" />
                </DockPanel.Resources>
                <Menu DockPanel.Dock="Top" SnapsToDevicePixels="True">
                    <MenuItem Header="File">
                        <MenuItem Header="New Patient Admission" Visibility="{Binding CanViewReports,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Name="_newAdmissionMenuItem" Click="_newAdmissionMenuItem_Click" />
                        <Separator />
                        <MenuItem Header="Exit" Name="_exit" Click="_exit_Click" />
                        <Separator />
                        <MenuItem Header="Refresh My Security" Command="{Binding RefreshUserSecurityCommand}" />
                    </MenuItem>
                    <MenuItem Header="Reports" ItemsSource="{Binding ReportsMenuItems}">
                        
                    </MenuItem>
                    <MenuItem Header="Tools">
                        <MenuItem Header="Reassign Patients" Click="ReassignPatientsClick" />
                        <Separator />
                        <MenuItem Click="EditCrossCoveringPhysicians_click" Visibility="{Binding CanViewReports,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Header="Cross Cover Schedule" />
                        <Separator />
                        <MenuItem Click="ImportMedicalProfessionals_Click" Visibility="{Binding CanViewReports,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Header="Import Medical Professionals from Excel" />
                        <Separator />
                        <MenuItem Header="Calculator" Click="Calculator_Click" />
                        <Separator />
                        <MenuItem Header="Physician Phone Book" Click="PhysicianPhoneBook_Click"/>
                        <MenuItem Header="Manage Medical Professionals" Visibility="{Binding CanViewReports,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Click="ManageMedicalProfessionals_Click"/>
                        <Separator />
                        <MenuItem Header="Light Manager" Visibility="{Binding CanViewReports,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Click="LightManager_Click" />
                        <Separator />
                        <MenuItem Visibility="{Binding CanEnableEditingOfDischargePatients,Mode=OneWay, UpdateSourceTrigger=PropertyChanged, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" Command="{Binding EnableEditingOfDischargedPatientsCommand}">
                            <MenuItem.Header>
                                <TextBlock Text="{Binding EditingOfDischargedPatientsMenuText,Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"/>
                            </MenuItem.Header>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="View Patient Lab Alerts for All Patients" Command="{Binding ViewAllPatientLabAlertCommand}" Visibility="{Binding CurrentUser.DisplayLabAlertIconOnAllPatients, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsefalse}" />
                        <MenuItem Header="View Patient Lab Alerts for only My Patients" Command="{Binding ViewOnlyMyAssignedPatientLabAlertCommand}" Visibility="{Binding CurrentUser.DisplayLabAlertIconOnAllPatients, Converter={StaticResource BooleanVisibilityConverter}, ConverterParameter=collapsed}" />
                    </MenuItem>
                    <MenuItem Header="Help">
                        <MenuItem Header="Index" Click="ShowHelpIndex" />
                        <Separator />
                        <MenuItem Click="ShowAboutDialog" Header="About PediNotes"/>
                    </MenuItem>
                </Menu>
                <Grid SnapsToDevicePixels="True">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <my:SourceObjectContainer Background="#293955" SnapsToDevicePixels="True" x:Name="_sourceObjectContainer">

                    </my:SourceObjectContainer>
                    <Border Grid.Row="1"  BorderThickness="20,0,20,25" BorderBrush="#293955" Background="{DynamicResource VSBackgroundBrush}" >
                        <!--<Rectangle Fill="{DynamicResource KidsNoteImage}" Width="350" Height="230" />-->
                        <Rectangle Fill="{DynamicResource InfanotesMainScreenImage}" Width="350" Height="230" />
                    </Border>
                    <docking:DockSite x:Name="_dockSite" Background="Transparent" Grid.Row="1" CanDocumentWindowsRaft="True" SnapsToDevicePixels="True" Foreground="White" >
                        <docking:DockSite.AutoHideLeftContainers>
                            <docking:ToolWindowContainer x:Name="_sourceItemsToolWindowContainer" docking:DockSite.ControlSize="370,500" TitleBarForegroundActive="White" TitleBarForegroundInactive="White" TitleBarBackgroundActive="{DynamicResource VSBackgroundBrush}" TitleBarBackgroundInactive="{DynamicResource VSBackgroundBrush}" SnapsToDevicePixels="True"/>
                        </docking:DockSite.AutoHideLeftContainers>
                        <docking:Workspace Background="Transparent">
                            <docking:TabbedMdiHost x:Name="_tabbedMDIHost" SnapsToDevicePixels="True" Background="{DynamicResource VSBackgroundBrush}" Foreground="White" TabPlacement="Top" IsCloseButtonOnTab="True" TabOverflowBehavior="ScrollWithMenu">
                                <docking:TabbedMdiContainer BorderThickness="0" SnapsToDevicePixels="True">

                                </docking:TabbedMdiContainer>
                            </docking:TabbedMdiHost>
                        </docking:Workspace>
                        <docking:DockSite.AutoHideRightContainers>
                            <docking:ToolWindowContainer x:Name="_alertItemsToolWindowContainer" TitleBarForegroundActive="White" TitleBarForegroundInactive="White" TitleBarBackgroundActive="{DynamicResource VSBackgroundBrush}" TitleBarBackgroundInactive="{DynamicResource VSBackgroundBrush}"/>
                        </docking:DockSite.AutoHideRightContainers>
                    </docking:DockSite>
                </Grid>
            </DockPanel>

Comments (1)

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

Hi Billy,

It would be difficult to say what the issue could be without a sample that reproduces it. Obviously something it trying to modify a brush that has been frozen, maybe the stack trace can give an indication as to what.

If you can please put together a small sample project that reproduces your issue and email it over then we can take a closer look. Be sure to remove any executables or change the extension of the zip file to ensure it gets past our email filters.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) 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.