Problem displaying a new image resource in a Silverlight 4 application

I have a Silverlight application that I am working on. I have several different custom button styles that use a ContentTemplate to display a button image, for example:

<Style x:Key="CancelButtonStyle" TargetType="Button">
    <Setter Property="Cursor" Value="Hand"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="Button">
                <Grid>
                    <Image Source="Assets/Images/Controls/cancel.png"/>
                    <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                </Grid>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

cancel.png is a recently added image and it is not displayed. If I add a simple image to the page with the source code set for this image, I get an underline in the XMAL design viewer with a warning

File "Assets / Images / Controls / cancel.png" - is not part of the project or its Action 'property not set' Resource '

, "". csproj, , ? , , .

, , , ?

<Image Source="Foo.Bar;component/Assets/Images/Controls/cancel.png" Stretch="None"/>
+3
2

, :

Source="/Foo.Bar;component/Assets/Images/Controls/cancel.png" 

.

+2

, , , . , XAML, , , , , .

- ? , , , , .

0

Source: https://habr.com/ru/post/1754380/


All Articles