mirror of
https://github.com/denglihong2007/CRSim
synced 2026-08-09 02:56:00 +08:00
style: 改善参数设置体验
This commit is contained in:
19
CRSim/Converters/BooleanToVisibilityConverter.cs
Normal file
19
CRSim/Converters/BooleanToVisibilityConverter.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace CRSim.Converters
|
||||
{
|
||||
public class BooleanToVisibilityConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is bool b)
|
||||
{
|
||||
return b ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:CRSim.Controls"
|
||||
xmlns:converters="clr-namespace:CRSim.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:CRSim.Views"
|
||||
@@ -12,7 +13,9 @@
|
||||
d:DesignWidth="800"
|
||||
Foreground="{DynamicResource TextFillColorPrimaryBrush}"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Page.Resources>
|
||||
<converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
|
||||
</Page.Resources>
|
||||
<Grid x:Name="ContentPagePane" Height="Auto">
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
@@ -104,8 +107,8 @@
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
<Border Style="{StaticResource SettingsCardStyle}">
|
||||
<Grid IsEnabled="{Binding ViewModel.PlatformNeeded}">
|
||||
<Border Style="{StaticResource SettingsCardStyle}" Visibility="{Binding ViewModel.PlatformNeeded,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
@@ -124,8 +127,8 @@
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<Border Style="{StaticResource SettingsCardStyle}">
|
||||
<Grid IsEnabled="{Binding ViewModel.TicketCheckNeeded}">
|
||||
<Border Style="{StaticResource SettingsCardStyle}" Visibility="{Binding ViewModel.TicketCheckNeeded,Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
|
||||
Reference in New Issue
Block a user