title: String can not be converted to System.Windows.Control.Label
body: <p>I have a problem with a code line in my Wpf Apllication.<code>label.Content = (string)nextfruit["q_text"];</code>I get this error (The type "string" can not be implicitly converted to "System.Windows.Controls.Label") I think this should work in the way I have done. </p>
  
  <p><strong>There is my code</strong></p>
  
  <pre><code>using System;
  using System.IO;
  using System.Net;
  using System.Windows;
  using System.Web.Script.Serialization;
  using System.Collections.Generic;
  using Newtonsoft.Json;
  using System.Json;
  using System.Linq;
  using Newtonsoft.Json.Linq;
  
   namespace MMPI2_Test
    {
      /// &lt;summary&gt;
     /// Interaktionslogik für Patient.xaml
     /// &lt;/summary&gt;
   public partial class Patient : Window
  {
      public Patient()
      {
          InitializeComponent();
          Loaded += MyWindow_Loaded;
      }
  
  
      public String MyProperty { get; set; }
  
      public String Property { get; set; }
  
      private IEnumerator&lt;JObject&gt; Enumerator { get; set; }
      public bool HasNext { get; private set; }
  
  
  
  
      private void MyWindow_Loaded(object sender, RoutedEventArgs e)
      {
          dynamic convert = JsonConvert.DeserializeObject(MyProperty);
  
          string user = MyProperty;
          //lbuser.Content = json;
  
  
         //string tan = "";
          MainWindow main = new MainWindow();
          // main.alpha = tan;
  
          string html = string.Empty;
          string url = @"http://stidl.workcloud.at/?tag=question&amp;token=" + Property;
  
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
          request.AutomaticDecompression = DecompressionMethods.GZip;
  
          using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
          using (Stream stream = response.GetResponseStream())
          using (StreamReader reader = new StreamReader(stream))
          {
              html = reader.ReadToEnd();
          }
          // dynamic magic = JsonConvert.DeserializeObject(html);
          // string json2 = new JavaScriptSerializer().Serialize(html);
  
  
          var j = new JavaScriptSerializer().DeserializeObject(user) as Dictionary&lt;string, object&gt;;
          var d = j["data"] as Dictionary&lt;string, object&gt;;
          lbuser.Content = d["fname"] + " " + d["lname"].ToString();
  
          //JObject QuestionObject = JObject.Parse(html);
          //JToken question = QuestionObject["data"].First["q_text"];
          //lbquestion.Content = question;
  
          JObject QuestionObject = JObject.Parse(html);
          Enumerator = QuestionObject["data"].Children&lt;JObject&gt;().GetEnumerator();
  
          JObject IDObject = JObject.Parse(html);
          JToken id = IDObject["data"].First["q_id"];
          JToken lastid = IDObject["data"].Last["q_id"];
          //JToken nextid = IDObject["data"].First.Next.Next["q_id"];
          lbid.Content = "Frage " + id + " von " + lastid;
  
  
      }
  
      class qq
      { 
  
      }
  
      private void bt_no_Click(object sender, RoutedEventArgs e)
      {
  
          string html = string.Empty;
          string url = @"http://stidl.workcloud.at/?tag=question&amp;token=" + Property;
  
          HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
          request.AutomaticDecompression = DecompressionMethods.GZip;
  
          using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
          using (Stream stream = response.GetResponseStream())
          using (StreamReader reader = new StreamReader(stream))
          {
              html = reader.ReadToEnd();
          }
          //JObject IDObject = JObject.Parse(html);
          //JToken nextid = IDObject["data"].First["q_id"];
          ////int result = (int)nextid;
          //lbid.Content = nextid;
  
          HasNext = Enumerator.MoveNext();
          if (HasNext)
          {
              JObject QuestionObject = JObject.Parse(html);
              Enumerator = QuestionObject["data"].Children&lt;JObject&gt;().GetEnumerator();
              JObject nextfruit = Enumerator.Current;
              lbquestion = (string)nextfruit["q_text"];
          }
          else
          {
  
          }
  
  
      }
  
      private void bt_yes_Click(object sender, RoutedEventArgs e)
      {
  
      }
  
      //public class QuestionData
      //{
      //    public string Data { get; set; } // this will store the JSON string
      //    public List&lt;Data&gt; DataList { get; set; } // this will be the actually list. 
      //}
  
      //public class Data
      //{
      //    public string q_id { get; set; }
      //    public string q_text { get; set; }
  
  
      //}
  
  
   }
  }
  </code></pre>
  
  <p><strong>My XML Code</strong></p>
  
  <pre><code>&lt;Window x:Class="MMPI2_Test.Patient"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
      xmlns:local="clr-namespace:MMPI2_Test"
      mc:Ignorable="d"
      Title="Patient" Height="560" Width="980"&gt;
  &lt;Window.Background&gt;
      &lt;ImageBrush ImageSource="images/background.jpg" /&gt;
  &lt;/Window.Background&gt;
  
  &lt;Grid&gt;
      &lt;Label x:Name="lbquestion" Content="" HorizontalAlignment="Left" Margin="31,229,0,0" VerticalAlignment="Top" Width="906" Height="71"/&gt;
      &lt;Button x:Name="bt_yes" Content="Ja" HorizontalAlignment="Left" Margin="534,349,0,0" VerticalAlignment="Top" Width="75" Click="bt_yes_Click" /&gt;
      &lt;Button x:Name="bt_no" Content="Nein" HorizontalAlignment="Left" Margin="389,349,0,0" VerticalAlignment="Top" Width="75" Click="bt_no_Click"/&gt;
      &lt;Label x:Name="lbuser" Content="" HorizontalAlignment="Left" Height="73" Margin="31,151,0,0" VerticalAlignment="Top" Width="906"/&gt;
      &lt;Label x:Name="lbid" Content="" HorizontalAlignment="Left" Height="50" Margin="31,69,0,0" VerticalAlignment="Top" Width="783"/&gt;
  
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>