Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>How about using <code>TextBlocks</code> to display Body and Created? The middle part would be a <code>RichTextBox</code>, you can use a Visibility converter to toggle hide/show if Upload is empty.</p> <p>You need to include your converter in your xaml page first,</p> <pre><code>xmlns:converters="clr-namespace:xxx.Converters;assembly=xxx" &lt;converters:VisibilityConverter x:Key="visibilityConverter" /&gt; </code></pre> <p>then use it inside your template,</p> <pre><code> &lt;StackPanel Margin="40,237,8,326" Width="432" Grid.Row="1"&gt; &lt;RichTextBox&gt; &lt;Paragraph&gt; &lt;Run Text="{Binding Body}" FontSize="25" FontFamily="Segoe WP"&gt;&lt;/Run&gt; &lt;/Paragraph&gt; &lt;/RichTextBox&gt; &lt;RichTextBox Visibility="{Binding Upload, Converter={StaticResource VisibilityConverter}}"&gt; &lt;Paragraph&gt; &lt;Hyperlink NavigateUri="{Binding Upload}" TargetName="_blank" FontSize="25" FontFamily="Segoe WP"&gt;{Binding Upload}&lt;/Hyperlink&gt; &lt;/Paragraph&gt; &lt;/RichTextBox&gt; &lt;TextBlock Text="{Binding Created}" FontFamily="Segoe WP SemiLight"/&gt; &lt;/StackPanel&gt; </code></pre> <p>The converter should be something like this,</p> <pre><code> public class VisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { bool visible = true; if (value is bool) { visible = (bool)value; } else if (value is int || value is short || value is long) { visible = 0 != (int)value; } else if (value is float || value is double) { visible = 0.0 != (double)value; } else if (value is string) { visible = ((string)value).Length &gt; 0; } else if (value == null) { visible = false; } if ((string)parameter == "!") { visible = !visible; } return visible ? Visibility.Visible : Visibility.Collapsed; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } </code></pre> <p>For more info regarding value converter, see <a href="http://weblogs.asp.net/psheriff/archive/2010/09/24/using-value-converters-in-silverlight.aspx" rel="nofollow">this</a>.</p> <p><strong>UPDATE</strong></p> <p>In your App.xaml, do this,</p> <pre><code>&lt;Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sg="http://schemas.stargategroup.com.au/2010/xaml/presentation" xmlns:converters="clr-namespace:xxx.Converters" x:Class="xxx.Application.App"&gt; &lt;Application.Resources&gt; &lt;ResourceDictionary&gt; &lt;converters:VisibilityConverter x:Key="VisibilityConverter" /&gt; </code></pre>
    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.
    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