Refactor
This commit is contained in:
parent
180d591b0a
commit
d62821cd60
12 changed files with 104 additions and 138 deletions
|
|
@ -1,5 +0,0 @@
|
|||
<MenuItem xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LibationWinForms.AvaloniaUI.Controls.FormattableMenuItem">
|
||||
|
||||
</MenuItem>
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Controls
|
||||
{
|
||||
public partial class FormattableMenuItem : MenuItem, IStyleable
|
||||
{
|
||||
Type IStyleable.StyleKey => typeof(MenuItem);
|
||||
|
||||
private string _formatText;
|
||||
public string FormatText
|
||||
{
|
||||
get => _formatText;
|
||||
set
|
||||
{
|
||||
_formatText = value;
|
||||
Header = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Format(params object[] args)
|
||||
{
|
||||
var formatText = string.Format(FormatText, args);
|
||||
Header = formatText;
|
||||
return formatText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<TextBlock xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="LibationWinForms.AvaloniaUI.Controls.FormattableTextBlock">
|
||||
|
||||
</TextBlock>
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Styling;
|
||||
using System;
|
||||
|
||||
namespace LibationWinForms.AvaloniaUI.Controls
|
||||
{
|
||||
public partial class FormattableTextBlock : TextBlock, IStyleable
|
||||
{
|
||||
Type IStyleable.StyleKey => typeof(TextBlock);
|
||||
|
||||
private string _formatText;
|
||||
public string FormatText
|
||||
{
|
||||
get => _formatText;
|
||||
set
|
||||
{
|
||||
_formatText = value;
|
||||
Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Format(params object[] args)
|
||||
{
|
||||
return Text = string.Format(FormatText, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue