Dreamine.UI.Maui
1.0.1
Windows(WinUI)의 네이티브 `CheckBox`는 `WidthRequest`로 줄일 수 없는 거대한 최소 너비를 가져서 라벨과의 간격이 벌어지는 문제가 있어, 처음부터 직접 그려서 만들었습니다.
Toggle main menu visibility
로딩중...
검색중...
일치하는것 없음
DreamineCheckBox.xaml.cs
이 파일의 문서화 페이지로 가기
1
namespace
Dreamine.UI.Maui
;
2
19
public
partial class
DreamineCheckBox
: ContentView
20
{
29
public
static
readonly BindableProperty
IsCheckedProperty
= BindableProperty.Create(
30
nameof(
IsChecked
), typeof(
bool
), typeof(
DreamineCheckBox
),
false
,
31
defaultBindingMode: BindingMode.TwoWay,
32
propertyChanged: (b, _, n) => ((
DreamineCheckBox
)b).ApplyState());
33
42
public
static
readonly BindableProperty
TextProperty
= BindableProperty.Create(
43
nameof(
Text
), typeof(
string
), typeof(
DreamineCheckBox
),
string
.Empty,
44
propertyChanged: (b, _, n) => ((
DreamineCheckBox
)b).TextLabel.Text = (
string
)n);
45
54
public
bool
IsChecked
55
{
56
get
=> (bool)GetValue(
IsCheckedProperty
);
57
set
=> SetValue(
IsCheckedProperty
, value);
58
}
59
68
public
string
Text
69
{
70
get
=> (string)GetValue(
TextProperty
);
71
set
=> SetValue(
TextProperty
, value);
72
}
73
82
public
event
EventHandler<bool>?
CheckedChanged
;
83
92
public
DreamineCheckBox
()
93
{
94
InitializeComponent();
95
ApplyState
();
96
}
97
122
private
void
OnTapped
(
object
? sender, TappedEventArgs e)
123
{
124
IsChecked
= !
IsChecked
;
125
CheckedChanged
?.Invoke(
this
,
IsChecked
);
126
}
127
136
private
void
ApplyState
()
137
{
138
CheckMark.IsVisible =
IsChecked
;
139
Box.BackgroundColor =
IsChecked
? Color.FromArgb(
"#0d6efd"
) : Colors.Transparent;
140
Box.Stroke =
IsChecked
? Color.FromArgb(
"#0d6efd"
) : Color.FromArgb(
"#7A8AA0"
);
141
}
142
}
Dreamine.UI.Maui
Definition
DreamineCheckBox.xaml.cs:1
Dreamine.UI.Maui.DreamineCheckBox.TextProperty
static readonly BindableProperty TextProperty
Definition
DreamineCheckBox.xaml.cs:42
Dreamine.UI.Maui.DreamineCheckBox.CheckedChanged
EventHandler< bool >? CheckedChanged
Definition
DreamineCheckBox.xaml.cs:82
Dreamine.UI.Maui.DreamineCheckBox.OnTapped
void OnTapped(object? sender, TappedEventArgs e)
Definition
DreamineCheckBox.xaml.cs:122
Dreamine.UI.Maui.DreamineCheckBox.ApplyState
void ApplyState()
Definition
DreamineCheckBox.xaml.cs:136
Dreamine.UI.Maui.DreamineCheckBox.DreamineCheckBox
DreamineCheckBox()
Definition
DreamineCheckBox.xaml.cs:92
Dreamine.UI.Maui.DreamineCheckBox.Text
string Text
Definition
DreamineCheckBox.xaml.cs:69
Dreamine.UI.Maui.DreamineCheckBox.IsChecked
bool IsChecked
Definition
DreamineCheckBox.xaml.cs:55
Dreamine.UI.Maui.DreamineCheckBox.IsCheckedProperty
static readonly BindableProperty IsCheckedProperty
Definition
DreamineCheckBox.xaml.cs:29
DreamineCheckBox.xaml.cs
다음에 의해 생성됨 :
1.17.0