WPF Markup Support Library(feat. CSharpforMarkup2)

์ด๋ฒˆ 5์›” BMW ๋ฐ‹์—… ๋ฐœํ‘œ
CSharpForMarkup2 ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์†Œ๊ฐœ๋ฅผ ํ•˜๊ธฐ ์œ„ํ•ด ์ƒ˜ํ”Œ์ฝ”๋“œ๋ฅผ ๋‹ค๋ฃจ๋˜ ์™€์ค‘์—
์˜ˆ์ „ LukeMauiMarkup ๊ณผ ๋™์ผํ•œ ๋ฐฉ์‹์˜ HotReload๋ฅผ ์‚ฌ์šฉํ•˜์˜€๊ธฐ ๋•Œ๋ฌธ์— ๊ฐœ๋ฐœ์ž๊ฐ€ ๋ถˆํ•„์š”ํ•œ ์ฝ”๋“œ ์„ธํŒ…์„ ์ค„์ด๊ธฐ ์œ„ํ•ด LukeMarkup ์‹œ๋ฆฌ์ฆˆ๋กœ Nuget์— ์˜ฌ๋ ธ์Šต๋‹ˆ๋‹ค.

CSharpForMarkup ๊ฐ„๋‹จ์†Œ๊ฐœ

C#๊ธฐ๋ฐ˜์˜ ์–ธ์–ด๋กœ UI๋ฅผ ๊ทธ๋ฆฐ๋‹ค๋Š” ์ทจ์ง€๋กœ ๋Ÿฐํƒ€์ž„ ์ค‘(๋””๋ฒ„๊น… ์ค‘) ๊ฐ„๋‹จํ•œ ์ปจํŠธ๋กค ์ถ”๊ฐ€ ๋˜๋Š” ์ˆ˜์ • ํ›„ Ctrl + S(HotReload)์‹œ ์ˆ˜์ •๋œ ํ™”๋ฉด์ด ์‹ค์‹œ๊ฐ„ ์—…๋กœ๋“œ ์‹œํ‚ฌ ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.

Nuget์ฃผ์†Œ

ํ”„๋กœ์ ํŠธ ์ƒ˜ํ”Œ

์ฐจ์ด์ 

  • ํ™”๋ฉด ๊ทธ๋ฆฌ๋Š” ๋ฐฉ๋ฒ•์€ CSharpForMarkup2์˜ ๋ฐฉ์‹์„ ๊ทธ๋Œ€๋กœ ๋”ฐ๋ผํ•˜์˜€์œผ๋ฉฐ,
    ์•„๋ž˜ ์ƒ์† ํด๋ž˜์Šค(MarkupApplication, MarkupWindow, MarkupPage)๋ฅผ ํ†ตํ•ด CSharpForMarkup2๋ณด๋‹ค ๋น ๋ฅด๊ณ  ์‰ฝ๊ฒŒ ์ ‘๊ทผํ•  ์ˆ˜ ์žˆ๋‹ค๋Š” ์žฅ์ ์ด ์žˆ์Šต๋‹ˆ๋‹ค.

Starter ํด๋ž˜์Šค

public class Starter
{
    [STAThread]
    private  static void Main(string[] args)
    {
        _= new App ()
            .Run ();
    }
}

App ํด๋ž˜์Šค

public class App : MarkupApplication
{
    public App()
    {
        MainWindow = new MainWindow();
    }
}

MainWindow.cs

public class MainWindow : MarkupWindow
{
    public MainWindow()
    {
        this.Build();
    }

    public override void Build() => Content =
        VStack (
            Button()
        ).Background(Blue);
}
6 Likes