Skip to content

'Background' property does not point to a DependencyObject in path '(0).(1)'.' #679

@chrisdentremont

Description

@chrisdentremont

When I use ShowDialog() to show my WPF window, I am getting this error. I imported what I needed into the XAML, and the preview window is displaying the window correctly, but the exception is thrown when the code tries to open the window.

image
image
image
image

This is the full XAML of the window:

<Window x:Class="EMD_Addin_Manager.Windows.AddinSelectWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:EMD_Addin_Manager.Windows"
        xmlns:ui="http://schemas.modernwpf.com/2019"
        ui:WindowHelper.UseModernWindowStyle="True"
        mc:Ignorable="d" WindowStartupLocation="CenterScreen"
        Title="Select Addins To Export" Height="450" Width="400" ResizeMode="NoResize">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ui:ThemeResources RequestedTheme="Light" AccentColor="Green"/>
                <ui:XamlControlsResources />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="50" />
        </Grid.RowDefinitions>

        <ListBox Grid.Row="0" Name="Addins_ListBox" SelectionMode="Extended" Margin="4" />

        <Grid Grid.Row="1">
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="4">
                <Button Name="Select_All_Button" Height="25" Width="75" Content="Select All" Margin="4" Click="Select_All_Button_Click" />
                <Button Name="Select_None_Button" Height="25" Width="75" Content="Select None" Margin="4" Click="Select_None_Button_Click" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="4">
                <Button Name="OK_Button" Height="25" Width="75" Content="OK" Margin="4" Click="OK_Button_Click" />
                <Button Name="Cancel_Button" Height="25" Width="75" Content="Cancel" Margin="4" Click="Cancel_Button_Click" />
            </StackPanel>
        </Grid>
    </Grid>
</Window>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions