title: WPF bind image via WCF to TileLayoutControl from ViewModel
body: <p>My system is working like this.I have a WCF service,which is giving me ImageUrl and I am downloading this Image to my project directory and save it to my file system. Then I want to show this Image in Devexpress TileLayoutControl dynamically. But not showing anything on UI.Also I am not getting error. I tried to give ımage source like this ../MenuPhotos/imagename and like this /TileExample;component/MenuPhotos/imagename</p>
  
  <p>My codes are like this;</p>
  
  <p>XAML;</p>
  
  <pre><code>&lt;dxlc:TileLayoutControl Name="TileList" AllowItemMoving="True" ItemsSource="{Binding Items}" ShowLayerSeparators="True" Padding="40,60,40,10" AllowLayerSizing="True" &gt;
  
      &lt;dxlc:TileLayoutControl.Resources&gt;
          &lt;Style TargetType="dxlc:Tile"&gt;
              &lt;Setter Property="BorderBrush" Value="Blue" /&gt;
              &lt;!--&lt;Setter Property="Background" Value="{Binding BackgroundColor}" /&gt;--&gt;
              &lt;Setter Property="Background" Value="{Binding BackgroundColor}" /&gt;
              &lt;Setter Property="Size" Value="{Binding SizeType}" /&gt;
              &lt;Setter Property="ContentTemplate"&gt;
                  &lt;Setter.Value&gt;
                      &lt;DataTemplate&gt;
                          &lt;Grid&gt;
                          &lt;Image Stretch="UniformToFill"  HorizontalAlignment="Center" VerticalAlignment="Center"&gt;
                                  &lt;Image.Source&gt;
                                      &lt;BitmapImage UriSource="/TileExample;component/MenuPhotos/restaurant1.jpg" /&gt;
                                  &lt;/Image.Source&gt;
                              &lt;/Image&gt;
                              &lt;Image Stretch="Uniform" Source="{Binding IconImageUrl}" HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                          &lt;/Grid&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="Header" Value="{Binding}" /&gt;
              &lt;Setter Property="HeaderTemplate"&gt;
                  &lt;Setter.Value&gt;
                      &lt;DataTemplate&gt;
                          &lt;TextBlock Text="{Binding BackgroundImageUrl}" FontFamily="Segoe UI Light" FontSize="12" /&gt;
                      &lt;/DataTemplate&gt;
                  &lt;/Setter.Value&gt;
              &lt;/Setter&gt;
              &lt;Setter Property="dxlc:TileLayoutControl.IsFlowBreak" Value="{Binding IsFlowBreak}" /&gt;
              &lt;Setter Property="dxlc:TileLayoutControl.GroupHeader" Value="Menü" /&gt;
              &lt;Setter Property="dxwuin:Navigation.NavigateTo" Value="{Binding PageName}" /&gt;
              &lt;Setter Property="dxwuin:Navigation.NavigationParameter" Value="1" /&gt;
          &lt;/Style&gt;
  
          &lt;Style TargetType="dxlc:TileGroupHeader"&gt;
              &lt;Setter Property="Foreground" Value="#FFFFFFFF" /&gt;
          &lt;/Style&gt;
  
      &lt;/dxlc:TileLayoutControl.Resources&gt;
  &lt;/dxlc:TileLayoutControl&gt;
  </code></pre>
  
  <p>And my viewmodel like this;</p>
  
  <pre><code>IEnumerable&lt;ImageItemsModel&gt; items;
  public GroupedItemsViewModel()
  {
  }
  public IEnumerable&lt;ImageItemsModel&gt; Items
  {
      get { return items; }
      private set { SetProperty&lt;IEnumerable&lt;ImageItemsModel&gt;&gt;(ref items, value, "Items"); }
  }
  public void LoadState(object navigationParameter)
  {
      MyServiceclient = new MyServiceclient();
      var items = client.GetAllItems(null);
      string remoteUri = "http://example.com/";
      foreach (var item in items)
      {
          if (item.BackgroundImageUrl == null)
          {
              item.BackgroundImageUrl = "/TileExample;component/Assets/Images/user.jpg";
          }
          else
          {
  
              string remotefilepath = item.BackgroundImageUrl.Replace("../", "").Replace("//", "/");
              string remotefilename = remotefilepath.Replace("img/integration/Dashboard/bg/", "");
              string myStringWebResource = null;
              using (WebClient myWebClient = new WebClient())
              {
                  string path = @"C:\Users\USER\Documents\Visual Studio 2013\Projects\TileExample\TileExample\MenuPhotos\";
                  string checkpath = @"C:\Users\USER\Documents\Visual Studio 2013\Projects\TileExample\TileExample\MenuPhotos\" + remotefilename;
                  if (!Directory.Exists(path))
                  {
                      Directory.CreateDirectory(path);
                  }
                  if (!File.Exists(checkpath))
                  {
                      myStringWebResource = remoteUri + remotefilepath;
                      try
                      {
                          string downloadintopath = Path.Combine(path, remotefilename);
                          myWebClient.DownloadFile(myStringWebResource, downloadintopath);
                      }
                      catch { }
                  }
              }
  
              item.BackgroundImageUrl = item.BackgroundImageUrl.Replace("../../img/integration/Dashboard/bg", "../MemberPhotos");
          }
  
      }
  
      Items = items;
  }
  #region INavigationAware Members
  public void NavigatedFrom(NavigationEventArgs e)
  {
  }
  public void NavigatedTo(NavigationEventArgs e)
  {
      LoadState(e.Parameter);
  }
  public void NavigatingFrom(NavigatingEventArgs e)
  {
  }
  #endregion
  </code></pre>
  
  <p>In UI I couldnt saw nothing about my images.If I will include images as a source to visual studio its working.But I will fill to image as a service. So I cannot use this workaround.Thanks.</p>