Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to draw dash line in grid row windows phone
    primarykey
    data
    text
    <p>Currently, I have a grid row with 3 columns: text (with padding indent), dash line and icon. I expect the result like this:</p> <p><img src="https://i.stack.imgur.com/Q9BWp.png" alt="result"></p> <p>The problem is I can't fix draw line width between text and icon and it isn't dash line, as below: <img src="https://i.stack.imgur.com/IB0B2.png" alt="error"></p> <p>Here is my data template:</p> <pre><code> &lt;DataTemplate x:Key="TreeItemTemplate"&gt; &lt;Grid Width="456"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="6*"/&gt; &lt;ColumnDefinition Width="3*"/&gt; &lt;ColumnDefinition Width="1*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;!-- Text --&gt; &lt;TextBlock Margin="0,0,1,0" Visibility="{Binding NormalTextVisible}" TextWrapping="Wrap" Text="{Binding Name, Mode=TwoWay}" d:LayoutOverrides="Width, Height" Foreground="{Binding Colour}" Padding="{Binding ActualIndent, Mode=TwoWay}" FontSize="{StaticResource PhoneFontSizeMedium}"/&gt; &lt;!-- Line--&gt; &lt;Path Grid.Column="1" Stroke="Red" StrokeThickness="2" StrokeDashArray="1 2 3" Stretch="Fill"&gt; &lt;Path.Data&gt; &lt;LineGeometry StartPoint="0,1" EndPoint="1,1" /&gt; &lt;/Path.Data&gt; &lt;/Path&gt; &lt;!-- Icon--&gt; &lt;Grid Grid.Column="2" HorizontalAlignment="Right" &gt; &lt;Button Style="{StaticResource IconButton}" Height="42" Width="42" HorizontalAlignment="Right"&gt; &lt;ImageBrush ImageSource="{Binding Image}" Stretch="None"/&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre> <p>And my listbox:</p> <pre><code> &lt;ListBox x:Name="lstTreeView" HorizontalAlignment="Stretch" VerticalAlignment="Top" ItemsSource="{Binding TreeViewModel.TreeData, Mode=TwoWay}" ItemTemplate="{StaticResource TreeItemTemplate}"/&gt; </code></pre> <p>Is there any way to achieve that?</p> <p><strong>Update</strong>: @Ivan Crojach Karačić: Thanks for your help. I tried your way, it worked. But the problem is when I set the first column width as <code>auto</code>, the long text can't wrap in a new line and icon is disappeared (without setting <code>auto</code>, text can wrap normally). You can see the row "Lennin House,..." from this image:</p> <p><img src="https://i.stack.imgur.com/wLUph.png" alt="e"> </p> <p>Can you fix it? Thanks in advance.</p> <p><strong>Update 2</strong>: Here is my try with wrap text issue</p> <pre><code>&lt;DataTemplate x:Key="TreeItemTemplate"&gt; &lt;Grid Width="456"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="Auto"/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition Width="42"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;!-- Text --&gt; &lt;Grid Grid.Column="0"&gt; &lt;TextBlock HorizontalAlignment="Stretch" Margin="0,0,1,0" VerticalAlignment="Center" Visibility="{Binding NormalTextVisible}" TextWrapping="Wrap" Text="{Binding Name, Mode=TwoWay}" d:LayoutOverrides="Width, Height" Foreground="{Binding Colour}" Padding="{Binding ActualIndent, Mode=TwoWay}" FontSize="{StaticResource PhoneFontSizeMedium}"/&gt; &lt;/Grid&gt; &lt;!-- Line--&gt; &lt;Line X1="0" Y1="21" X2="500" Y2="21" Stroke="Red" StrokeDashArray="4,1" StrokeThickness="2" Margin="3" Grid.Column="1" VerticalAlignment="Center" Height="42"/&gt; &lt;!-- Icon--&gt; &lt;Grid Grid.Column="2" HorizontalAlignment="Right" &gt; &lt;Button Style="{StaticResource IconButton}" Height="42" Width="42" HorizontalAlignment="Right"&gt; &lt;ImageBrush ImageSource="{Binding Image}" Stretch="None"/&gt; &lt;/Button&gt; &lt;/Grid&gt; &lt;/Grid&gt; </code></pre> <p></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.
    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