mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
add border
This commit is contained in:
parent
bf64ec8af0
commit
d8919e5aea
@ -140,6 +140,17 @@
|
||||
"Orientation": "Orientation"
|
||||
}
|
||||
},
|
||||
"Border": {
|
||||
"SuperClass": "FrameworkElement",
|
||||
"IsCreatable": true,
|
||||
"Attributes": {
|
||||
"Background": "Brush",
|
||||
"BorderBrush": "Brush",
|
||||
"BorderThickness": "Thickness",
|
||||
"Padding": "Thickness",
|
||||
"CornerRadius": "CornerRadius"
|
||||
}
|
||||
},
|
||||
"RowDefinition": {
|
||||
"IsCreatable": true,
|
||||
"Attributes": {
|
||||
|
@ -32,6 +32,7 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
|
||||
["Image"] = HandleXmlElement_Image,
|
||||
["Grid"] = HandleXmlElement_Grid,
|
||||
["StackPanel"] = HandleXmlElement_StackPanel,
|
||||
["Border"] = HandleXmlElement_Border,
|
||||
|
||||
["SolidColorBrush"] = HandleXmlElement_SolidColorBrush,
|
||||
["ImageBrush"] = HandleXmlElement_ImageBrush,
|
||||
|
@ -729,6 +729,37 @@ namespace Bloxstrap.UI.Elements.Bootstrapper
|
||||
|
||||
return stackPanel;
|
||||
}
|
||||
|
||||
private static Border HandleXmlElement_Border(CustomDialog dialog, XElement xmlElement)
|
||||
{
|
||||
var border = new Border();
|
||||
|
||||
ApplyBrush_UIElement(dialog, border, "Background", Border.BackgroundProperty, xmlElement);
|
||||
ApplyBrush_UIElement(dialog, border, "BorderBrush", Border.BorderBrushProperty, xmlElement);
|
||||
|
||||
object? borderThickness = GetThicknessFromXElement(xmlElement, "BorderThickness");
|
||||
if (borderThickness != null)
|
||||
border.BorderThickness = (Thickness)borderThickness;
|
||||
|
||||
object? padding = GetThicknessFromXElement(xmlElement, "Padding");
|
||||
if (padding != null)
|
||||
border.Padding = (Thickness)padding;
|
||||
|
||||
object? cornerRadius = GetCornerRadiusFromXElement(xmlElement, "CornerRadius");
|
||||
if (cornerRadius != null)
|
||||
border.CornerRadius = (CornerRadius)cornerRadius;
|
||||
|
||||
var children = xmlElement.Elements().Where(x => !x.Name.ToString().StartsWith("Border."));
|
||||
if (children.Any())
|
||||
{
|
||||
if (children.Count() > 1)
|
||||
throw new Exception("Border can only have one child");
|
||||
|
||||
border.Child = HandleXml<UIElement>(dialog, children.First());
|
||||
}
|
||||
|
||||
return border;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user