Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF textblock binding with List<string>
    primarykey
    data
    text
    <p>does anyone know if there is a simple way to bind a textblock to a List. What I've done so far is create a listview and bind it to the List and then I have a template within the listview that uses a single textblock.</p> <p>what I'd really like to do is just bind the List to a textblock and have it display all the lines.</p> <p>In Winforms there was a "Lines" property that I could just throw the List into, but I'm not seeing it on the WPF textblock, or TextBox.</p> <p>Any ideas?</p> <p>did I miss something simple?</p> <p>Here's the code</p> <pre><code>&lt;UserControl x:Class="QSTClient.Infrastructure.Library.Views.WorkItemLogView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="500" Height="400"&gt; &lt;StackPanel&gt; &lt;ListView ItemsSource="{Binding Path=Logs}" &gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridViewColumn Header="Log Message"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBlock Text="{Binding}"/&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; &lt;/StackPanel&gt; </code></pre> <p></p> <p>and the WorkItem Class</p> <pre><code>public class WorkItem { public string Name { get; set; } public string Description { get; set; } public string CurrentLog { get; private set; } public string CurrentStatus { get; private set; } public WorkItemStatus Status { get; set; } public ThreadSafeObservableCollection&lt;string&gt; Logs{get;private set;} </code></pre> <p>I'm using Prism to create the control and put it into a WindowRegion</p> <pre><code> WorkItemLogView newView = container.Resolve&lt;WorkItemLogView&gt;(); newView.DataContext = workItem; regionManager.Regions["ShellWindowRegion"].Add(newView); </code></pre> <p>thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload