我在項目中擁擠了頁面,我想在單個頁面中放置太多的複選框控件,所以我正在尋找一種方法來調整我的複選框。 當我改變我的複選框的高度和寬度,其文本的一部分消失,換句話說,我需要縮放我的複選框,並使一些小複選框。調整Windows通用應用程序中的複選框
0
A
回答
3
當然你也可以通過使用ScaleTransform
但修改其風格,使您更多的靈活性規模下來。
下面是一個例子 -
<Style x:Key="TinyCheckBoxStyle"
TargetType="CheckBox">
<Setter Property="Padding"
Value="4,0,0,0" />
<Setter Property="HorizontalContentAlignment"
Value="Left" />
<Setter Property="FontSize"
Value="11" />
<Setter Property="MinWidth"
Value="0" />
<Setter Property="MinHeight"
Value="0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<Grid x:Name="RootGrid"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<VisualStateManager.VisualStateGroups>
<!-- Add default visual states back in here -->
</VisualStateManager.VisualStateGroups>
<Grid>
<Rectangle x:Name="NormalRectangle"
Fill="{ThemeResource CheckBoxCheckBackgroundFillUnchecked}"
Height="12"
Stroke="{ThemeResource CheckBoxCheckBackgroundStrokeUnchecked}"
StrokeThickness="{ThemeResource CheckBoxBorderThemeThickness}"
UseLayoutRounding="False"
Width="12" />
<FontIcon x:Name="CheckGlyph"
Foreground="{ThemeResource CheckBoxCheckGlyphForegroundUnchecked}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
Glyph=""
Opacity="0" />
</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>
基本上,你需要減少NormalRectangle
,CheckGlyph
和FontSize
大小。注意我已經刪除了視覺狀態來簡化答案,您只需要將它們從default style中添加回來即可。
+1
這正是我想要的,我很抱歉,我沒有正確地問這個問題。 –
+0
不用擔心。這就是爲什麼有一個編輯按鈕的問題。 :) –
相關問題
- 1. Wpf Windows Store應用程序複選框無法調整
- 2. 用於Windows應用程序的互斥複選框
- 3. 列表框和複選框 - XAML/C# - Windows 8應用程序
- 4. HTML應用程序「複選框」響應
- 5. Windows通用應用程序中的TaskbarItemInfo
- 6. Windows窗體應用程序複選框佈局
- 7. 應用程序時,點擊複選框
- 8. 在AppleScript中調整Windows中Unscriptable應用程序的大小
- 9. 應用程序在Windows Phone 8中的應用程序通信
- 10. 調整C#Windows應用程序中的datagrid列
- 11. 調整Windows窗體應用程序中的標籤大小
- 12. 調整WPF應用程序
- 13. 調整應用程序
- 14. 調整Mapkit應用程序
- 15. 調整應用程序中的UIPickerView
- 16. 用Shiny應用程序中的複選框切換ggvis圖層
- 17. 如何通過c#應用程序用UI調用外部Windows應用程序?
- 18. 複選框調整大小
- 19. 如何在Windows Phone應用程序中保存複選框的值
- 20. 在通用應用程序中調整大小視圖
- 21. 在Windows 8.1通用應用程序中創建選項卡
- 22. 在Silverlight中爲Windows Phone 7應用程序調整LineHeight
- 23. 在Windows窗體中調整控件位置應用程序
- 24. 在Windows應用程序中調整標籤文本大小
- 25. 在通用的Windows應用程序
- 26. 在Windows 8中FlipView周圍的選定邊框應用程序
- 27. 在Windows應用程序中篩選文本框的問題
- 28. 如何調試反應本機通用Windows應用程序?
- 29. 在Windows 10通用應用程序中調用C#組件JavaScript通用應用程序
- 30. Qt:setGeometry不在應用程序的調整中調整大小
您是否檢出了CheckBox的[默認樣式](https://msdn.microsoft.com/en-us/library/windows/apps/mt299114.aspx?f=255&MSPPError=-2147217396)?他們有一個最小寬度'120'。 –
我知道,但我需要一個小小的複選框......解決方案是什麼? –
是否用於電話?因爲那時你的用戶也需要小手指。 –