c# - Silverlight Binding Issue -


OK, so I've tried to apply the cover flow found on codeplex

I Want to use self to class data for binding:

  class cover item {bitmap image_image; String _ title; String _link; String _ content; Public bitmap image image {get {return_image; } Set {_image = value; }} Public string title {get {return _title; } Set {_title = value; }} Public string link {get {return_link; } Set {_link = value; }} Public string content {get {return_content; } Set {_content = value; }}}  

This is Client Xml from CodePlex for user control:

  & lt; Custom: Coverflocontrol.immetlet & gt; & Lt; DataTemplate & gt; & Lt; StackPanel & gt; & Lt; Image source = "{binding image}" width = "300" /> & Lt; Text block text = "{binding title}" width = "300" /> & Lt; Text block text = "test" width = "300" /> & Lt; / StackPanel & gt; & Lt; / DataTemplate & gt; & Lt; / Custom: CoverFlowControl.ItemTemplate & gt;  

The problem I am facing is that I get the word "test" for each element which was bound, but I am not getting an image or title, which is related to my items Item source: Property of control

Cover. ITMSSource = _items;

My question is, where am I wrong? It should be a simple binding, so I'm missing something.

Thank you in advance for help.

Edit:

If I code this:

  list & lt; Bitmap image & gt; Images = new list & amp; Lt; Bitmap image & gt; () {_items [0]. Images, _Items [1] Image, _IToms [2]. Image, _items [3]. Image}; Cover. ITEMS source = Picture; //_items;  

and after this is binding:

  & lt; Image source = "{binding}" width = "300" />  

Now I display my images. So I know that this is somewhat binding.

has also tried

  & lt; Image source = "{binding path = image}" width = "300" />  

cover item make the class public. One of Silverlight's Downsides is allowed to reflection which is not permitted under internal types of internal assemblies. When binding for CLR properties, reflection is used to get value. The assembly which is trying to get the value is the system. Windows, and it will not be allowed to display the internal type in your assembly.

I have written about this in the context of an anonymous type (the internal type):

Alternatively, by giving an internal VivekTo attribute on your assembly to allow the system For the window to "see" its internal type.

-Math description, see this MSDN link:

In Silverlight, you can not use reflection to access personal types and members If the access level of any type or member will prevent you from entering a steady code, you can not access it dynamically using the image.

and

Silverlight only supports binding for public type.


Comments