Skip to content

Commit

Permalink
uncap height and width
Browse files Browse the repository at this point in the history
  • Loading branch information
bluepilledgreat committed Oct 22, 2024
1 parent 254fd46 commit 3eb8938
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,6 @@ private static void ValidateXmlElement(string elementName, string attributeName,
}

// 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)
{
int value = ParseXmlAttribute<int>(element, attributeName, defaultValue);
Expand Down Expand Up @@ -522,8 +515,8 @@ private static void HandleXmlElement_FrameworkElement(CustomDialog dialog, Frame
if (margin != null)
uiElement.Margin = (Thickness)margin;

uiElement.Height = ParseXmlAttributeClamped(xmlElement, "Height", defaultValue: double.NaN, min: 0, max: 1000);
uiElement.Width = ParseXmlAttributeClamped(xmlElement, "Width", defaultValue: double.NaN, min: 0, max: 1000);
uiElement.Height = ParseXmlAttribute<double>(xmlElement, "Height", double.NaN);
uiElement.Width = ParseXmlAttribute<double>(xmlElement, "Width", double.NaN);

// default values of these were originally Stretch but that was no good
uiElement.HorizontalAlignment = ParseXmlAttribute<HorizontalAlignment>(xmlElement, "HorizontalAlignment", HorizontalAlignment.Left);
Expand Down
2 changes: 2 additions & 0 deletions Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
Height="450"
MinWidth="150"
MinHeight="150"
MaxWidth="1000"
MaxHeight="1000"
Background="{ui:ThemeResource ApplicationBackgroundBrush}"
ExtendsContentIntoTitleBar="True"
ResizeMode="NoResize"
Expand Down

0 comments on commit 3eb8938

Please sign in to comment.