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

GridLength.Start does not take into account Padding & Margin #345

Open
RolandUI opened this issue Feb 24, 2025 · 0 comments
Open

GridLength.Start does not take into account Padding & Margin #345

RolandUI opened this issue Feb 24, 2025 · 0 comments

Comments

@RolandUI
Copy link

RolandUI commented Feb 24, 2025

When either horizontal Padding or Margin is set on the Row, the content doesn't fit in the table and the horizontal scrollbar becomes visible.

GridLength.Start should take them into account.

20250224-1552-01.4300016.mp4

Repo:

<TreeDataGrid Source="{Binding Source}">
    <TreeDataGrid.Styles>
        <Style Selector="TreeDataGridRow > Border#RowBorder">
            <Setter Property="Padding" Value="1" />
            <!-- <Setter Property="Margin" Value="1" /> -->
        </Style>
    </TreeDataGrid.Styles>
</TreeDataGrid>
public partial class MainWindowViewModel : ViewModelBase
{
    private ObservableCollection<Person> _people = new()
    {
        new Person { FirstName = "Eleanor", LastName = "Pope", Age = 32 },
        new Person { FirstName = "Jeremy", LastName = "Navarro", Age = 74 },
        new Person { FirstName = "Lailah ", LastName = "Velazquez", Age = 16 },
        new Person { FirstName = "Jazmine", LastName = "Schroeder", Age = 52 },
    };
    
    public MainWindowViewModel()
    {
        
        Source = new FlatTreeDataGridSource<Person>(_people)
        {
            Columns =
            {
                new TextColumn<Person, string>("First Name", x => x.FirstName, width: GridLength.Auto),
                new TextColumn<Person, string>("Last Name", x => x.LastName, width: GridLength.Star),
                new TextColumn<Person, int>("Age", x => x.Age, width: GridLength.Auto),
            },
        };
    }

    public FlatTreeDataGridSource<Person> Source { get; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant