Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tree view items are not indented when created from code-behind #292

Closed
martinchrzan opened this issue Feb 24, 2021 · 1 comment
Closed
Labels
bug Something isn't working
Milestone

Comments

@martinchrzan
Copy link

martinchrzan commented Feb 24, 2021

There is a different look if I create a treeview from code vs in xaml

Here is my code definition

            var level3 = new TreeViewItem() { Header = "Level 3", IsExpanded = true };
            var level2 = new TreeViewItem() { Header = "Level 2", IsExpanded = true };
            var level1 = new TreeViewItem() { Header = "Level 1", IsExpanded = true };
            treeViewFromCode.Items.Add(level1);
            level1.Items.Add(level2);
            level2.Items.Add(level3);

Here is XAML

<Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <TreeView x:Name="treeViewFromCode"/>

        <TreeView Grid.Row="1">
            <TreeViewItem Header="Level 1" IsExpanded="True">
                <TreeViewItem Header="Level 2" IsExpanded="True">
                    <TreeViewItem Header="Level 3" IsExpanded="True"/>
                </TreeViewItem>
            </TreeViewItem>
        </TreeView>
    </Grid>

When I run it:
image

When I am not using ModernWPF, it looks like this (correctly)
image

Used version 0.9.3

@Kinnara Kinnara added the bug Something isn't working label Mar 23, 2021
@Kinnara
Copy link
Owner

Kinnara commented Mar 23, 2021

Thanks for reporting.

@Kinnara Kinnara added this to the 0.9.4 milestone Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants