Skip to content

Commit

Permalink
add markdowntextblocks
Browse files Browse the repository at this point in the history
  • Loading branch information
bluepilledgreat committed Oct 20, 2024
1 parent 4c48278 commit e1aa35e
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions Bloxstrap/UI/Elements/Bootstrapper/CustomDialog.Creator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Xml.Linq;

using Wpf.Ui.Markup;

using Bloxstrap.UI.Elements.Controls;

namespace Bloxstrap.UI.Elements.Bootstrapper
{
public partial class CustomDialog
Expand Down Expand Up @@ -36,6 +39,7 @@ public partial class CustomDialog
["Button"] = HandleXmlElement_Button,
["ProgressBar"] = HandleXmlElement_ProgressBar,
["TextBlock"] = HandleXmlElement_TextBlock,
["MarkdownTextBlock"] = HandleXmlElement_MarkdownTextBlock,
["Image"] = HandleXmlElement_Image
};

Expand Down Expand Up @@ -490,9 +494,8 @@ private static void HandleXmlElement_ProgressBar(CustomDialog dialog, XElement x
dialog.ElementGrid.Children.Add(progressBar);
}

private static void HandleXmlElement_TextBlock(CustomDialog dialog, XElement xmlElement)
private static void HandleXmlElement_TextBlock_Base(CustomDialog dialog, TextBlock textBlock, XElement xmlElement)
{
var textBlock = new TextBlock();
HandleXmlElement_FrameworkElement(dialog, textBlock, xmlElement);

textBlock.Text = xmlElement.Attribute("Text")?.Value;
Expand Down Expand Up @@ -529,6 +532,24 @@ private static void HandleXmlElement_TextBlock(CustomDialog dialog, XElement xml
}

ApplyTransformations_UIElement(textBlock, xmlElement);
}

private static void HandleXmlElement_TextBlock(CustomDialog dialog, XElement xmlElement)
{
var textBlock = new TextBlock();
HandleXmlElement_TextBlock_Base(dialog, textBlock, xmlElement);

dialog.ElementGrid.Children.Add(textBlock);
}

private static void HandleXmlElement_MarkdownTextBlock(CustomDialog dialog, XElement xmlElement)
{
var textBlock = new MarkdownTextBlock();
HandleXmlElement_TextBlock_Base(dialog, textBlock, xmlElement);

string? text = xmlElement.Attribute("Text")?.Value;
if (text != null)
textBlock.MarkdownText = text;

dialog.ElementGrid.Children.Add(textBlock);
}
Expand Down

0 comments on commit e1aa35e

Please sign in to comment.