subash
subash

Reputation: 4137

how to set background for a silverlight canvas?

I have the following code but was unable to set background for the 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>

Upvotes: 2

Views: 778

Answers (1)

danbord
danbord

Reputation: 4096

Set your canvas a Height and Width.

Since you specified VerticalAlignment="Top" and HorizontalAlignment="Left" the Canvas size does not stretch in the grid.

Upvotes: 3

Related Questions