checkbox 相关问题

复选框是一个图形用户界面元素,允许用户进行二进制选择。

在 Laravel 中激活/停用多个客户端

我正在使用 Laravel 5.1 我有一张客户桌。客户将创建他们的帐户并等待管理员批准。管理员可以随时激活、停用或阻止它们。我有三个链接(我可以更改...

回答 1 投票 0

取消选中数据 DataGridView 中的复选框时清除文本框

在 FormLoad 的 DataGridView2 中使用此复选框 Dim chk1 As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn() DataGridView2.Columns.Add(chk1) chk1.HeaderText = "Keuze&quo...

回答 1 投票 0

PyQt Tree Widget,添加动态删除复选框

我正在尝试创建一个树小部件,它本质上允许用户查看数据的各种细分,并可以选择删除某些项目。为了做到这一点,我想检查...

回答 5 投票 0

如何在WPF单选按钮中设计类似复选框的样式

我想要一个类似于复选框的单选按钮,所以我在字典文件中定义了一个样式,例如: 我想要一个类似于复选框的单选按钮,所以我在字典文件中定义了一个样式,例如: <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfCheckBoxLikeRadiobutton"> <Style x:Key="MyRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Grid> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" IsHitTestVisible="False" /> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" Opacity="0"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 并将其合并到 app.xaml 文件中,如下所示 <Application x:Class="WpfCheckBoxLikeRadiobutton.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfCheckBoxLikeRadiobutton" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Dictionary1.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> 然后在我的窗口中使用它 <GroupBox Margin="5" Padding="5"> <StackPanel > <CheckBox Content="this is checkbox" /> <RadioButton Content="this is first radio button" Style="{DynamicResource MyRadioButton}"/> <RadioButton Content="this is Second radio button" Style="{DynamicResource MyRadioButton}"/> <RadioButton Content="this is third radio button" Style="{DynamicResource MyRadioButton}"/> </StackPanel> </GroupBox> 但是为单选按钮指定样式后,该内容将消失。 我的风格有什么问题吗? 发生这种情况是因为您忽略了自己的控制内容ControlTemplate。你的风格应该是这样的: <Style x:Key="MyRadioButton" TargetType="{x:Type RadioButton}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Grid> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" IsHitTestVisible="False" Content="{TemplateBinding Content}" /> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" Content="{TemplateBinding Content}" Opacity="0"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> 我认为你甚至可以做得更简单,让它看起来更好,只需右键单击 --> EditStyle 并用模板中的矩形替换每个椭圆。有很多动画你不会因为这种方式而丢失。 这就是我所做的,看起来不错,如果你愿意,你也可以从复选框样式中复制“CheckIcon”,使其看起来完全像一个复选框。 除了 Verbon 的答案之外,我还有一种样式,其中复选框看起来像单选按钮。 <Style x:Key="CheckBoxRadioButtonStyle" TargetType="CheckBox"> <Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/> <Setter Property="Padding" Value="3"/> <Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> <Setter Property="MinWidth" Value="30"/> <Setter Property="UseSystemFocusVisuals" Value="True"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="CheckBox"> <Grid BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="20"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CommonStates"> <VisualState x:Name="Normal"/> <VisualState x:Name="PointerOver"> </VisualState> <VisualState x:Name="Pressed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="CheckOuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseMediumBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckOuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckGlyph"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseMediumBrush}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Disabled"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="CheckOuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckOuterEllipse"> <DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckGlyph"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> </ObjectAnimationUsingKeyFrames> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlDisabledBaseLowBrush}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> <VisualStateGroup x:Name="CheckStates"> <VisualState x:Name="Checked"> <Storyboard> <DoubleAnimation Duration="1" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckGlyph"/> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterEllipse"/> <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckOuterEllipse"/> </Storyboard> </VisualState> <VisualState x:Name="Unchecked"> <Storyboard> <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="OuterEllipse"/> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckOuterEllipse"/> <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckGlyph"/> </Storyboard> </VisualState> <VisualState x:Name="Indeterminate"/> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid Height="32" VerticalAlignment="Top"> <Ellipse x:Name="OuterEllipse" Height="20" Fill="Green" Stroke="Green" Opacity="0" StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" UseLayoutRounding="False" Width="20"/> <Ellipse x:Name="CheckOuterEllipse" Fill="White" Height="20" Opacity="1" Stroke="Gray" StrokeThickness="{ThemeResource RadioButtonBorderThemeThickness}" UseLayoutRounding="False" Width="20"/> <Ellipse x:Name="CheckGlyph" Fill="White" Height="12" Opacity="1" UseLayoutRounding="False" Width="12"/> </Grid> <ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" Grid.Column="1" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextWrapping="Wrap" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> 然后将上面的样式合并到Verbon的样式中: <Grid> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" IsHitTestVisible="False" Content="{TemplateBinding Content}" Style="{StaticResource CheckBoxRadioButtonStyle}"/> <CheckBox IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsChecked, Mode=TwoWay}" Content="{TemplateBinding Content}" Opacity="0" Style="{StaticResource CheckBoxRadioButtonStyle}"/> </Grid>

回答 3 投票 0

如何使用vb.net将选中和未选中的复选框从datagridview保存到数据库?

私有子 btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 处理 btnSave.Click 尝试 myconnection.Open() '变量声明 暗淡 str As ...

回答 1 投票 0

Blazor - InputCheckbox:根据数据库表中的内容进行复选框

我正在尝试根据数据库表中包含的数字预填充复选框。例如,表条目可以包括: 用户身份 商品编号 1 4 1 5 1 10 2 4 2 6 2 54 在我的页面上,我会

回答 1 投票 0

CSS 问题,文本和复选框未对齐

我有一个 css 样式问题,其中文本框和文本未对齐。下面是我的代码。我需要帮助来解决这个问题。 谢谢 我有一个 css 样式问题,其中文本框和文本未对齐。下面是我的代码。我需要帮助来解决这个问题。 谢谢 <div> <input type="checkbox" [checked]="section?.data?.allowMe" class="pointer-events-none" /> <label class="ml-2 view-text" for="allMe" >Allow LostOfData to be Seen</label > </div> 使用 Flexbox (https://css-tricks.com/snippets/css/a-guide-to-flexbox/): div { display: flex; align-items: center; }

回答 1 投票 0

Bootstrap 5 Accordion 中的意外复选框行为

我有一个选择的复选框项目,我想将它们放入 Bootstrap 5 手风琴元素中。复选框项目在开放状态下工作正常(选中复选框会将项目添加到数组中;取消选中它们...

回答 1 投票 0

PrimeNg 复选框执行功能

我一直在尝试让一个函数在按下数据表中的复选框时发生。基本上我拥有的是一个包含默认值的数据表(例如 1 到 10)。然后我给出一个数组

回答 1 投票 0

当我的所有复选框输入都具有相同名称时,如何滚动到第一个错误?

我正在使用 React 18、Ionic 7 和 Formik 2.4.3。当我想滚动到错误位置的顶部时,我使用一个组件 导出 const getFieldErrorNames = (formikErrors) => { 合作...

回答 1 投票 0

确保至少选中一个复选框

我有一个带有多个复选框的表单,我想使用 JavaScript 来确保至少选中一个。这就是我现在所拥有的,但无论选择什么,都会弹出警报。 JS(错误)

回答 11 投票 0

Excel 改进建议:在自动筛选下拉列表中仅选择一个复选框的快捷方式

我们当前在 Excel 中使用过滤器所做的一件事是仅显示一个特定值。 大多数情况下,过滤器复选框是“全部或部分选择”(很少全部未选择),以便显示...

回答 1 投票 0

如何防止点击子节点时覆盖TreeSelect复选框自动折叠

在primeNg的网站文档中https://primeng.org/treeselect#checkbox 首先,我单击“文档”复选框 ->“主页”复选框 当我单击文档 -> 主页时 其次,我单击发票复选框 资源...

回答 1 投票 0

如何获取React复选框值

我正在构建一个简单的密码生成器,用户单击“提交”按钮,然后根据选中的输入复选框显示密码。 我目前有 4 个状态用于 e...

回答 1 投票 0

如何使用 React ref 聚焦并选择复选框?

我一直在寻找一种在 React 代码中正确聚焦并选择复选框的方法。 我在下面的示例中使用的方法 focus() 和 select() 不起作用: 导入 React,{ 我们...

回答 4 投票 0

如何在syncfusion pdf flutter中添加复选框?

如何在pdf flutter中添加复选框? Syncfusion_flutter_pdf:^20.3.58 Flutter版本是3.0.2 如果同步融合表格不是免费的,请告诉我。 下面的代码在我生成的 pdf 中不可见。 文件...

回答 1 投票 0

将 Quasar q-checkbox 答案放入数组中的数组中

我有一个名为答案的数组。我想将不同问题的答案存储在该数组中。我的一种问题类型是 q 复选框,用于选择多个答案。因为它有可能...

回答 1 投票 0

请告诉我我做错了什么,无论我做什么,我似乎都无法在同一行中获得标签和单选、复选框图标

这是我的代码示例 这是我的代码示例 <div class="form-check"> <label for""> <input type="radio" name="user-select" value="onetwo" class="one-to-two" checked>1-2 hours </label><br/> </div> <div class="form-check"> <label> <input type="radio" name="user-select" value="threefour" class="three-to-four"/> 3-4 hours </label> </div> <div class="form-check-career"> <input type="checkbox" class="form-check-input" id="check1" name="Front End" value="something"> <label class="form-check-label">Front-End Developer</label> </div> <div class="form-check-career"> <input type="checkbox" class="form-check-input" id="check2" name="Back End" value="something"> <label class="form-check-label">Back-End Developer</label> </div> <div class="form-check-career"> <input type="checkbox" class="form-check-input" id="check3" name="Full Stack" value="something"> <label class="form-check-label">Full Stack Developer</label> </div> 这是我的一些CSS label { display: block; margin: 0.5rem 0; } input { margin: 10px 0 10px 0; width: 100%; min-height: 2em } input[type="radio"] { flex-direction: row; } 我尝试了网上能找到的所有方法,但都不起作用,这令人沮丧。这些复选框和单选图标无法按照我的预期与标签对齐。有人可以告诉我我做错了什么吗? 虽然不太清楚“排队”的含义,但如果您指的是水平居中,那么您可能需要更改一些代码。 由于您没有提供足够的代码作为上下文,请注意以下代码基于问题中发布的代码片段。 如果您按如下方式更改无线电输入 HTML: <div class="form-check"> <label for"">1-2 hours</label> <input type="radio" name="user-select" value="onetwo" class="one-to-two" checked /> </div> 并将 CSS 更改为以下内容: .form-check{ display:flex; align-items:center; justify-content:center; margin:0.5rem auto; } label { margin: 0.5rem; } input[type="radio"] { margin:0.5rem; display:flex; flex-direction: row; width:auto; } 然后输出应呈现为:

回答 1 投票 0

复选框仅在悬停或选中时可见

'要求是 onhover 复选框必须可见,但 onmouseout 选中的复选框必须可见,未选中的复选框必须不可见。我的问题是复选框悬停功能单独工作,但 ch...

回答 1 投票 0

如何使表单中的复选框有效

我有一个基本问题,但我找不到解决方案。 我如何强制我的用户选中该框:接受条件? (j'acceptes les Conditions d'utilizations = 我同意条款和条件...

回答 3 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.