Skip to main content

Microsoft Silverlight

Answered Question <class> does not contain a definition for <property>RSS Feed

(0)

silverlightdesigner
silverli...

Member

Member

4 points

19 Posts

<class> does not contain a definition for <property>

Hi,

I tried this question earlier and did not get a response, so I am trying again as I am still stuck!

I have a collection of string values that I am binding to some TextBlocks in a Silverlight project.  The string values are showing up fine when I run the project.  However, I added another string:

 Link ="Some more stuff"

 and Blend 3 throws an error, which says:

'OlympicMediaComponentOne.StoryInfo' does not contain a definition for 'Link'

Here is a code snippet:

In MainPage.xaml.cs:

namespace OlympicMediaComponentOne

{

public partial class MainPage : UserControl

{

private List<StoryInfo> stories;private StoryInfo selectedStory;

 

public MainPage()

{

// Required to initialize variables

InitializeComponent();

stories =
new List<StoryInfo>();

stories.Add(new StoryInfo() { Headline = "US Gold Haul", Body = "Speed skating becomes a sensation at the winter olympics as US pick up seven gold medals in four days.", Link = "Play video", Image = new BitmapImage(new Uri("Images/1lg.png", UriKind.Relative)) });

ImageListBox.ItemsSource = stories;

DetailsPanel.ItemsSource = stories;

TransitionDetails.ItemsSource = stories;

In DetailPage.xaml I have this:

<StackPanel Orientation="Vertical" UseLayoutRounding="True" Margin="0" d:LayoutOverrides="HorizontalMargin" HorizontalAlignment="Left" VerticalAlignment="Top" Width="216" MinHeight="75">
   <Grid>
    <TextBlock x:Name="DetailsHeadlineCrossFade" Foreground="White" FontFamily="Arial" FontSize="12" Margin="8,6,4,0" TextWrapping="Wrap" FontWeight="Bold" />
    <TextBlock x:Name="DetailsHeadline" Text="{Binding Headline, Mode=OneWay}" Foreground="White" FontFamily="Arial" FontSize="12" Margin="8,6,4,0" TextWrapping="Wrap" FontWeight="Bold" />
   </Grid>
   <Grid Margin="0,0,0,11">
    <TextBlock x:Name="DetailsBodyCrossFade" Foreground="White" FontFamily="Arial" FontSize="10.667" Margin="8,4,4,0" TextWrapping="Wrap" />
    <TextBlock x:Name="DetailsBody" Text="{Binding Body, Mode=OneWay}" Foreground="White" FontFamily="Arial" FontSize="10.667" LineHeight="13" Margin="8,4,8,0" TextWrapping="Wrap" />
   </Grid>
   <Grid>
    <TextBlock x:Name="DetailsLinkCrossFade" Foreground="White" FontFamily="Arial" FontSize="10.667" Margin="8,4,8,0" TextWrapping="Wrap" />
    <TextBlock x:Name="DetailsLink" Text="{Binding Link, Mode=OneWay}" Margin="8,0,0,0" FontFamily="Arial" FontSize="10.667" Foreground="White" TextWrapping="Wrap"/>
   </Grid>
   
  </StackPanel>

Can anyone tell me how to get this extra srting value recognized by Blend?

Thanks in advance.

Nick Barling

Sergey.Lutay
Sergey.L...

Contributor

Contributor

7250 points

1,351 Posts

Re: <class> does not contain a definition for <property>

Hi Nick,

Show please a definition of StoryInfo class.

(If this has answered your question, please click on "mark as answer" on this post. Thank you!)

Blog

Twitter

Sincerely,
Sergey Lutay

silverlightdesigner
silverli...

Member

Member

4 points

19 Posts

Re: Re: <class> does not contain a definition for <property>

All I did was this, which you can see in the original snippet:

private List<StoryInfo> stories;

public MainPage()

{

// Required to initialize variables

InitializeComponent();

stories =
new List<StoryInfo>();

stories.Add(new StoryInfo() { Headline = "US Gold Haul", Body = "Speed skating becomes a sensation at the winter olympics as US pick up seven gold medals in four days.", Link = "Play video", Image = new BitmapImage(new Uri("Images/1lg.png", UriKind.Relative)) });

Nick Barling

silverlightdesigner
silverli...

Member

Member

4 points

19 Posts

Answered Question

Re: Re: <class> does not contain a definition for <property>

I found the error, the public string declaration in the StoryInfo() class was missing the set; cmd.

Nick Barling
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities