|
| 1 | +--- |
| 2 | +title: CheckComboBox 复选组合框 |
| 3 | +--- |
| 4 | + |
| 5 | +可选选中多个项目的组合框. |
| 6 | + |
| 7 | +```cs |
| 8 | +[TemplatePart(Name = ElementPanel, Type = typeof(Panel))] |
| 9 | +[TemplatePart(Name = ElementSelectAll, Type = typeof(CheckComboBoxItem))] |
| 10 | +public class CheckComboBox : ListBox, IDataInput |
| 11 | +``` |
| 12 | + |
| 13 | +# 属性 |
| 14 | + |
| 15 | +|属性|描述|默认值|备注| |
| 16 | +|-|-|-|-| |
| 17 | +|VerifyFunc|数据验证委托||| |
| 18 | +|IsError|数据是否错误|false|| |
| 19 | +|ErrorStr|错误提示||| |
| 20 | +|TextType|文本类型||| |
| 21 | +|ShowClearButton|是否显示清除按钮|false|| |
| 22 | +|MaxDropDownHeight|下拉内容最大高度||| |
| 23 | +|IsDropDownOpen|下拉框是否展开|false|| |
| 24 | +|TagStyle|选中标记样式||| |
| 25 | +|ShowSelectAllButton|是否显示选中所有按钮|false||| |
| 26 | + |
| 27 | +# 附加属性 |
| 28 | + |
| 29 | +|属性|描述|默认值|备注| |
| 30 | +|-|-|-|-| |
| 31 | +|InfoElement.Placeholder|占位符||| |
| 32 | +|InfoElement.Necessary|是否必填|false|| |
| 33 | +|InfoElement.Symbol|必填标记|●|| |
| 34 | +|InfoElement.ContentHeight|内容高度|30|标题在上时可用| |
| 35 | +|InfoElement.MinContentHeight|最小内容高度|30|标题在上时可用| |
| 36 | +|TitleElement.Title|标题||| |
| 37 | +|TitleElement.TitlePlacement|标题对齐方式|TitlePlacementType.Top|| |
| 38 | +|TitleElement.TitleWidth|标题宽度|120|| |
| 39 | +|DropDownElement.ConsistentWidth|下拉内容是否和下拉框宽度一致|false||| |
| 40 | + |
| 41 | +# 方法 |
| 42 | + |
| 43 | +|方法|描述|备注| |
| 44 | +|-|-|-| |
| 45 | +|VerifyData|验证数据|可手动触发验证| |
| 46 | + |
| 47 | +# 样式 |
| 48 | + |
| 49 | +|样式|描述| |
| 50 | +|-|-| |
| 51 | +|CheckComboBoxBaseStyle|默认样式| |
| 52 | +|CheckComboBoxExtendBaseStyle|默认扩展样式| |
| 53 | +|CheckComboBoxPlusBaseStyle|默认增强样式| |
| 54 | +|CheckComboBoxExtend|扩展样式| |
| 55 | +|CheckComboBoxPlus|增强样式| |
| 56 | + |
| 57 | +# 案例 |
| 58 | + |
| 59 | +```xml |
| 60 | +<StackPanel Margin="32" Orientation="Horizontal"> |
| 61 | + <StackPanel> |
| 62 | + <hc:CheckComboBox ShowClearButton="True" MaxWidth="380" ItemsSource="{Binding DataList}" ShowSelectAllButton="True"/> |
| 63 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" Style="{StaticResource CheckComboBoxExtend}" Margin="0,16,0,0" IsEnabled="False" ShowSelectAllButton="True"/> |
| 64 | + |
| 65 | + <hc:CheckComboBox ShowClearButton="True" MaxWidth="380" ItemsSource="{Binding DataList}" Style="{StaticResource CheckComboBoxExtend}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,32,0,0" ShowSelectAllButton="True"/> |
| 66 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" Style="{StaticResource CheckComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/> |
| 67 | + |
| 68 | + <hc:CheckComboBox ShowClearButton="True" Width="380" ItemsSource="{Binding DataList}" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" Style="{StaticResource CheckComboBoxExtend}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Margin="0,32,0,0" ShowSelectAllButton="True"/> |
| 69 | + <hc:CheckComboBox Width="380" ItemsSource="{Binding DataList}" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Style="{StaticResource CheckComboBoxExtend}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/> |
| 70 | + </StackPanel> |
| 71 | + <StackPanel Margin="32,0,0,0"> |
| 72 | + <hc:CheckComboBox ShowClearButton="True" MaxWidth="380" ItemsSource="{Binding DataList}" Style="{StaticResource CheckComboBoxPlus}" ShowSelectAllButton="True"/> |
| 73 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" Margin="0,16,0,0" IsEnabled="False" Style="{StaticResource CheckComboBoxPlus}"/> |
| 74 | + |
| 75 | + <hc:CheckComboBox MaxWidth="380" ShowClearButton="True" ItemsSource="{Binding DataList}" Style="{StaticResource CheckComboBoxPlus}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr1}}" Margin="0,32,0,0" ShowSelectAllButton="True"/> |
| 76 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr2}}" Style="{StaticResource CheckComboBoxPlus}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/> |
| 77 | + |
| 78 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" ShowClearButton="True" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" Style="{StaticResource CheckComboBoxPlus}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Margin="0,32,0,0" ShowSelectAllButton="True"/> |
| 79 | + <hc:CheckComboBox MaxWidth="380" ItemsSource="{Binding DataList}" Width="380" hc:InfoElement.TitleWidth="140" hc:InfoElement.TitlePlacement="Left" hc:InfoElement.Placeholder="{ex:Lang Key={x:Static langs:LangKeys.PlsEnterContent}}" hc:InfoElement.Title="{ex:Lang Key={x:Static langs:LangKeys.TitleDemoStr3}}" Style="{StaticResource CheckComboBoxPlus}" hc:InfoElement.Necessary="True" Margin="0,16,0,0"/> |
| 80 | + </StackPanel> |
| 81 | +</StackPanel> |
| 82 | +``` |
| 83 | + |
| 84 | + |
0 commit comments