gpt4 book ai didi

silverlight - 如何为 Silverlight Canvas 设置背景?

转载 作者:行者123 更新时间:2023-12-04 06:39:33 26 4
gpt4 key购买 nike

我有以下代码,但无法为 Canvas 设置背景:

<Grid x:Name="LayoutRoot"  >  
<Canvas Background="SkyBlue" VerticalAlignment="Top" HorizontalAlignment="Left" >
<dataInput:Label x:Name="LblOperation" Content="Choose the operation:" Width="200" Height="30" Canvas.Top="0" Canvas.Left="0"></dataInput:Label>
<ComboBox Width="100" Height="20" Canvas.Top="5" Canvas.Left="125">
<ComboBox.Items >
<ComboBoxItem Content="Reconcile" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="UnReconcile"></ComboBoxItem>
</ComboBox.Items>
</ComboBox>
<dataInput:Label x:Name="LblOperationmode" Content="Choose the operation Mode:" Width="200" Height="30" Canvas.Top="0" Canvas.Left="250"></dataInput:Label>
<ComboBox Width="125" Height="20" Canvas.Top="5" Canvas.Left="410">
<ComboBox.Items >
<ComboBoxItem Content="Cad Based" IsSelected="True"></ComboBoxItem>
<ComboBoxItem Content="SafetyPad Based"></ComboBoxItem>
</ComboBox.Items>
</ComboBox>
</canvas>
</grid>

最佳答案

将 Canvas 设置为高度和宽度。

由于您指定了 VerticalAlignment="Top"和 Horizo​​ntalAlignment="Left" Canvas 大小不会在网格中拉伸(stretch)。

关于silverlight - 如何为 Silverlight Canvas 设置背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4429281/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com