uncap height and width

This commit is contained in:
bluepilledgreat 2024-10-22 18:17:56 +01:00
parent 254fd46d94
commit 3eb8938abe
2 changed files with 4 additions and 9 deletions

View File

@ -123,13 +123,6 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
} }
// You can't do numeric only generics in .NET 6. The feature is exclusive to .NET 7+. // You can't do numeric only generics in .NET 6. The feature is exclusive to .NET 7+.
private static double ParseXmlAttributeClamped(XElement element, string attributeName, double? defaultValue = null, double? min = null, double? max = null)
{
double value = ParseXmlAttribute<double>(element, attributeName, defaultValue);
ValidateXmlElement(element.Name.ToString(), attributeName, value, min, max);
return value;
}
private static int ParseXmlAttributeClamped(XElement element, string attributeName, int? defaultValue = null, int? min = null, int? max = null) private static int ParseXmlAttributeClamped(XElement element, string attributeName, int? defaultValue = null, int? min = null, int? max = null)
{ {
int value = ParseXmlAttribute<int>(element, attributeName, defaultValue); int value = ParseXmlAttribute<int>(element, attributeName, defaultValue);
@ -522,8 +515,8 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
if (margin != null) if (margin != null)
uiElement.Margin = (Thickness)margin; uiElement.Margin = (Thickness)margin;
uiElement.Height = ParseXmlAttributeClamped(xmlElement, "Height", defaultValue: double.NaN, min: 0, max: 1000); uiElement.Height = ParseXmlAttribute<double>(xmlElement, "Height", double.NaN);
uiElement.Width = ParseXmlAttributeClamped(xmlElement, "Width", defaultValue: double.NaN, min: 0, max: 1000); uiElement.Width = ParseXmlAttribute<double>(xmlElement, "Width", double.NaN);
// default values of these were originally Stretch but that was no good // default values of these were originally Stretch but that was no good
uiElement.HorizontalAlignment = ParseXmlAttribute<HorizontalAlignment>(xmlElement, "HorizontalAlignment", HorizontalAlignment.Left); uiElement.HorizontalAlignment = ParseXmlAttribute<HorizontalAlignment>(xmlElement, "HorizontalAlignment", HorizontalAlignment.Left);

View File

@ -12,6 +12,8 @@
Height="450" Height="450"
MinWidth="150" MinWidth="150"
MinHeight="150" MinHeight="150"
MaxWidth="1000"
MaxHeight="1000"
Background="{ui:ThemeResource ApplicationBackgroundBrush}" Background="{ui:ThemeResource ApplicationBackgroundBrush}"
ExtendsContentIntoTitleBar="True" ExtendsContentIntoTitleBar="True"
ResizeMode="NoResize" ResizeMode="NoResize"