I'm displaying images in my datagrid using custom control and binding their url, in OOB this works but in web it doesn't display the images.

Kilitli I'm displaying images in my datagrid using custom control and binding their url, in OOB this works but in web it doesn't display the images.

  • 18 Temmuz 2011 Pazartesi 05:56
     
     

    I'm doing this

    IContentItemProxy image = this.FindControl("URL_SmallImage");
    image.SetBinding(System.Windows.Controls.Image.SourceProperty, "Value",System.Windows.Data.BindingMode.OneWay);

     

    this works in desktop app and displays the images, however when i run it as a web app, it doesn't display images

Tüm Yanıtlar

  • 18 Temmuz 2011 Pazartesi 15:41
     
     

    Just as an idea:

    Add a Computed Property to your Entity, e.g. "mySmallImage"; in the mySmallImage_Compute method load the data from the URL, convert it to a byte array and return it as result of the method.
    In the designer drag the new property into the datagrid as new (image-)column.

    I didn't tried it; but perhaps it's an approach.

    Best regards
    Robert

     


  • 18 Temmuz 2011 Pazartesi 16:14
     
     Yanıt
    Sounds like you are running into a URL Access Restriction. Please take a look at URL Access Restrictions in Silverlight and Network Security Access Restrictions in Silverlight for explanations of why you cannot do this and possibly for some alternatives (e.g. implementing a clientaccesspolicy.xml file to allow for certain types of access).
    Justin Anderson, LightSwitch Development Team
  • 20 Temmuz 2011 Çarşamba 06:33
     
     

    What if I'm getting the images from azure blob? https://*.windows.net/* ?

     

  • 20 Temmuz 2011 Çarşamba 15:17
     
     

    What you need to do is upload your clientaccesspolicy.xml file to the root BLOB of your Windows Azure Storage so that the policy file is available at https://*.blob.core.windows.net/clientaccesspolicy.xml. Steve Marx has a blog post on how to do this: http://blog.smarx.com/posts/uploading-windows-azure-blobs-from-silverlight-part-2-enabling-cross-domain-access-to-blobs. Hopefully, there is enough information there to help you resolve your issue.


    Justin Anderson, LightSwitch Development Team
  • 21 Temmuz 2011 Perşembe 03:15
     
     

    already uploaded it at https://*.blob.core.windows.net/.windows.net/clientaccesspolicy.xml

    it contains:

    <?xml version="1.0" encoding="UTF-8"?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from>
            <domain uri="http://*"/>
            <domain uri="https://*"/>
          </allow-from>
          <grant-to>
            <resource path="/" include-subpaths="true"/>
          </grant-to>
        </policy>
      </cross-domain-access>
    </access-policy>

    but images still don't show. Am I missing something?