开发者

Remove the border of image

I want to remove the border of image which is displayed when i click on it .

开发者_运维技巧

**<Image x:Name="ImagePresenter"  Source="{StaticResource IconDocument}"  />**

          <Rectangle x:Name="focusElement" Opacity="0" Stroke="{StaticResource color_506_brush}" StrokeThickness="1" IsHitTestVisible="False" RadiusX="4" RadiusY="4"/>
        </Grid>
      </Grid>
    </ControlTemplate>
  </Setter.Value>
</Setter>


Adding an image to a Silverlight UserControl results in just the image with no border displaying for me.

Xaml:

<Image x:Name="ImageText" Source="TestImage.png"/>

I assume that isn't going to help you. Could you give a bit more detail in your question and see if I can find a better answer?


Your question is not quite clear to me as silverlight doesnt add any border to image unless something in your code tells it to.

Try setting StrokeThickness to zero. (If required modify the template to set the strokethickness to zero).

Hope this helps


Yes you all were right by default the image doesn't have border. As i had two columns in my defined style it was creating two rectangles for each(one for my textblock another for image).To get rid of this I used one column defination and it worked. :)

          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
          </Grid.ColumnDefinitions>
          <Image x:Name="ImagePresenter" Grid.Column="0"  Source="{StaticResource IconDocument}" Width="15" HorizontalAlignment="Left"/>
          <TextBlock x:Name="TextPresenter" Grid.Column="0" Text="{Binding DocumentName}" Style="{StaticResource DocumentViewerOutputTextItem}" Margin="15 4 4 0"
              Visibility="{Binding IsSelected, Converter={StaticResource InvertVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
          <TextBlock Grid.Column="0" Text="{Binding DocumentName}" Style="{StaticResource DocumentViewerOutputTextItem_MouseOver}"  Margin="15 4 4 0"
              Visibility="{Binding IsSelected, Converter={StaticResource VisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>              
          <Rectangle x:Name="focusElement" Opacity="0" Stroke="{StaticResource color_506_brush}" StrokeThickness="1" IsHitTestVisible="False" RadiusX="4" RadiusY="4"/>
        </Grid>
      </Grid>
    </ControlTemplate>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜