Skip to content

Commit

Permalink
fix: 修复 BooleanToValueConverter 实现
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed Aug 14, 2024
1 parent 8bc8722 commit 2a6cb4c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 5 additions & 3 deletions EleCho.WpfSuite/ValueConverters/BooleanToValueConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ namespace EleCho.WpfSuite
/// <summary>
/// Convert boolean to any other type
/// </summary>
/// <typeparam name="TSelf"></typeparam>
/// <typeparam name="TValue"></typeparam>
public class BooleanToValueConverter<TValue> : SingletonValueConverterBase<BooleanToValueConverter<TValue>>
public class BooleanToValueConverter<TSelf, TValue> : SingletonValueConverterBase<TSelf>
where TSelf : BooleanToValueConverter<TSelf, TValue>, new()
{
/// <summary>
/// Result value when the boolean value is true
Expand Down Expand Up @@ -50,13 +52,13 @@ public TValue ValueWhenFalse
/// The DependencyProperty of <see cref="ValueWhenTrue"/> property
/// </summary>
public static readonly DependencyProperty ValueWhenTrueProperty =
DependencyProperty.Register(nameof(ValueWhenTrue), typeof(TValue), typeof(BooleanToValueConverter<TValue>), new PropertyMetadata(default(TValue)));
DependencyProperty.Register(nameof(ValueWhenTrue), typeof(TValue), typeof(BooleanToValueConverter<TSelf, TValue>), new PropertyMetadata(default(TValue)));

/// <summary>
/// The DependencyProperty of <see cref="ValueWhenFalse"/> property
/// </summary>
public static readonly DependencyProperty ValueWhenFalseProperty =
DependencyProperty.Register(nameof(ValueWhenFalse), typeof(TValue), typeof(BooleanToValueConverter<TValue>), new PropertyMetadata(default(TValue)));
DependencyProperty.Register(nameof(ValueWhenFalse), typeof(TValue), typeof(BooleanToValueConverter<TSelf, TValue>), new PropertyMetadata(default(TValue)));


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace EleCho.WpfSuite
/// <summary>
/// Convert boolean to visibility
/// </summary>
public class BooleanToVisibilityConverter : BooleanToValueConverter<Visibility>
public class BooleanToVisibilityConverter : BooleanToValueConverter<BooleanToVisibilityConverter, Visibility>
{
static BooleanToVisibilityConverter()
{
Expand Down
10 changes: 10 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ After installation, there is no need to import any resources, all you need to do
</Window>
```

## Sample App

Here's a screenshot from the WPF Suite sample program, to download it, go to [GitHub: Latest Release](https://github.com/OrgEleCho/EleCho.WpfSuite/releases/latest)

<div class=".d-flex">

<img src="/images/app1.png" height="300">

</div>

## About the project

EleCho.WpfSuite is &copy; 2024-{{ "now" | date: "%Y" }} by [EleCho](https://github.com/OrgEleCho).
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ WPF Suite 中还有许多值得探索的东西, 例如内容切换与页面跳
</Window>
```

## 示例图片
## 示例程序

下面是来自 WPF Suite 示例程序的一些截图
下面是来自 WPF Suite 示例程序的截图, 要下载, 请到 [GitHub 的最新 Release](https://github.com/OrgEleCho/EleCho.WpfSuite/releases/latest)

<div class=".d-flex">

Expand Down

0 comments on commit 2a6cb4c

Please sign in to comment.