DragablzItemsControl size
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Comienza con DragablzItemsControl.MeasureOverride y las llamadas de medición de ItemsOrganiser que se muestran en el issue. Reproduce el control con diferentes cantidades de elementos y una altura restringida; se considera terminado cuando crece con su contenido hasta alcanzar la restricción, después de lo cual aparece el desplazamiento.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- C#
- Estrellas
- 248
- Forks
- 40
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de MaterialDesignInXAML/MotionList
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 20/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 20/100
-
Button inside ItemAbierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
MaterialDesignInXAML/MotionList#4 · 1 comentario · 2 reacciones ·
Todos los issues de MaterialDesignInXAML/MotionList
Issues similares
-
0 - Backlog Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
BrighterCommand/Brighter#4444 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
area:frontend bug FE P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
klasolsson81/jobbliggaren#1915 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/vscode-copilotstudio#431 ·
Los mantenedores suelen responder en 2 días