locked
Image border in SilvERLIGHT RRS feed

  • Question

  • Hi all

    Can anyone tell me, How can we add a border to the image at runtime, I have structure for xaml is:-
     <Canvas x:Name="LayoutRoot" Background="Transparent">
            <Image x:Name="imgMainImage"  Visibility="Visible" Height="205" Width="180" ></Image>
        </Canvas>
    I have only to add border to image not to canvas.

     

    Wednesday, November 5, 2008 2:55 AM

Answers

  •  Hi,

    Normally to add a border you would use the "Border" control... which would wrap the image. e.g. <Border xxxxx><Image/></Border>.

    Perhaps add the border control to XAML, and set it's border thickness to 0 all round, then change it to the required thickness when needed.

    Cheers,

    Jordan.

    Wednesday, November 5, 2008 3:04 AM
  • Place your image inside border, like this:

    <Canvas x:Name="LayoutRoot" Background="Transparent">

    <Border BorderThickness="2,2,2,2" BorderBrush="#FF000000" >

    <Image x:Name="imgMainImage"  Visibility="Visible" Height="205" Width="180" />

    </Border>
        </Canvas>

    (Please 'Mark as Answer' if it helps you)

    Wednesday, November 5, 2008 3:18 AM

All replies

  •  Hi,

    Normally to add a border you would use the "Border" control... which would wrap the image. e.g. <Border xxxxx><Image/></Border>.

    Perhaps add the border control to XAML, and set it's border thickness to 0 all round, then change it to the required thickness when needed.

    Cheers,

    Jordan.

    Wednesday, November 5, 2008 3:04 AM
  • Place your image inside border, like this:

    <Canvas x:Name="LayoutRoot" Background="Transparent">

    <Border BorderThickness="2,2,2,2" BorderBrush="#FF000000" >

    <Image x:Name="imgMainImage"  Visibility="Visible" Height="205" Width="180" />

    </Border>
        </Canvas>

    (Please 'Mark as Answer' if it helps you)

    Wednesday, November 5, 2008 3:18 AM