DragablzItemsControl size
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với DragablzItemsControl.MeasureOverride và các lệnh gọi đo lường của ItemsOrganiser được hiển thị trong issue. Tái tạo control với số lượng item khác nhau và chiều cao bị giới hạn; hoàn thành khi nó mở rộng theo nội dung cho đến khi đạt giới hạn, sau đó thao tác cuộn xuất hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi,
Thank you for example, it looks cool and we’d like to implement it.
I’ve got one problem that I can’t get around until I modify one of your methods (which I don’t want to do until I must).
Basically, I want the DragablzItemsControl to start on as high as it need to be, and then as we add more records it should grow, until it reaches it maxheight then the scrollbar should appear. Instead the DragablzItemsControl height is the max from the beginning which can be seen if you change the background to a different color.
So, I noticed that the problems comes from here
protected override Size MeasureOverride(Size constraint)
{
if (ItemsOrganiser == null) return base.MeasureOverride(constraint);
if (LockedMeasure.HasValue)
{
ItemsPresenterWidth = LockedMeasure.Value.Width;
ItemsPresenterHeight = LockedMeasure.Value.Height;
return LockedMeasure.Value;
}
var dragablzItems = DragablzItems().ToList();
var maxConstraint = new Size(double.PositiveInfinity, double.PositiveInfinity);
ItemsOrganiser.Organise(this, maxConstraint, dragablzItems);
var measure = ItemsOrganiser.Measure(this, new Size(ActualWidth, ActualHeight), dragablzItems);
ItemsPresenterWidth = measure.Width;
ItemsPresenterHeight = measure.Height;
var width = double.IsInfinity(constraint.Width) ? measure.Width : constraint.Width;
var height = double.IsInfinity(constraint.Height) ? measure.Height : constraint.Height;
return new Size(width, height);
}
The constraint width or height are never infinity, so these values always come back as constraint values. My fix is this
protected override Size MeasureOverride(Size constraint)
{
if (ItemsOrganiser == null) return base.MeasureOverride(constraint);
if (LockedMeasure.HasValue)
{
ItemsPresenterWidth = LockedMeasure.Value.Width;
ItemsPresenterHeight = LockedMeasure.Value.Height;
return LockedMeasure.Value;
}
var dragablzItems = DragablzItems().ToList();
var maxConstraint = new Size(double.PositiveInfinity, double.PositiveInfinity);
ItemsOrganiser.Organise(this, maxConstraint, dragablzItems);
var measure = ItemsOrganiser.Measure(this, new Size(ActualWidth, ActualHeight), dragablzItems);
ItemsPresenterWidth = measure.Width;
ItemsPresenterHeight = measure.Height;
var width = double.IsInfinity(constraint.Width) || (dragablzItems.Count > 0 && constraint.Width > measure.Width) ? measure.Width : constraint.Width;
var height = double.IsInfinity(constraint.Height) || (dragablzItems.Count > 0 && constraint.Height > measure.Height) ? measure.Height : constraint.Height;
return new Size(width, height);
}
This way the itemscontrol always becomes as big as it needs to be for a given number of items, until it is bigger than the constraint then it does not grow any bigger and the scrollbar appears.
Hopefully it makes sense, is it possible for you to implement something like this, or is it a case that I must override this method in a derived class of my own?
Thank you
- Ngôn ngữ chính
- C#
- Star
- 248
- Fork
- 40
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MaterialDesignInXAML/MotionList
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
-
Button inside ItemĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
MaterialDesignInXAML/MotionList#4 · 1 bình luận · 2 reaction ·
Tất cả issue của MaterialDesignInXAML/MotionList
Issue tương tự
-
Money ExploitsĐang mởS: Untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
project-wayfarer/wayfarer-14#1628 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
:watch: Not Triaged dotnet-target-version
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
copilot documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
dotnet/dotnet-api-docs#13124 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày