如何在xaml中更改ToggleSwitch中实际开关的大小?我可以更改OnContent和OffContent的文本大小,但滑动开关永远不会改变大小.
这些都不会改变交换机本身的大小,只会改变它周围的框.
我在F#中有一个bool [,],我想得到真实存在的数量.如何在不进入命令式编程的情况下实现这一目标?
这是我目前的解决方案,它实际上只是用f#编写的c#.
let mutable x = 0
for cell in cells do
if cell = true then x <- x + 1
x
Run Code Online (Sandbox Code Playgroud) 我有一个函数getFullFitness
let getFullFitness population =
ResizeArray(population |> Seq.map snd) |> Seq.sum
Run Code Online (Sandbox Code Playgroud)
我在函数realTick中模式匹配
let realTick population =
match(getFullfitness population) with
|(50) -> population
| _ -> childGeneration population
Run Code Online (Sandbox Code Playgroud)
问题在线|(50) - >人口.由于getFullFitness返回一个整数和,如何在realTick中匹配0到50之间的值?
我有:
<DataTemplate x:Name="_ComboBoxTemplate" x:Key="_ComboBoxTemplate">
<StackPanel Orientation="Horizontal">
<StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<TextBlock VerticalAlignment="Center" Text="{Binding}" FontSize="24"/>
</StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
<ComboBox x:Name="_criteria" ItemTemplate="{StaticResource _ComboBoxTemplate}" ItemsSource="{Binding}"/>
Run Code Online (Sandbox Code Playgroud)
在后面的代码中:
this.DataContext = new string[] { "0", "1", "2", "3", "4", "5" };
Run Code Online (Sandbox Code Playgroud)
我如何得到它使默认SelectedItem的ComboBox是5?