Reputation: 1466
I have the following code:
<ListView x:Name="lstSync" Margin="0,240,0,110" ItemsSource="{x:Bind Path=ViewModel.SyncItems}" ItemClick="gridViewAll_ItemClick" IsItemClickEnabled="True" SelectionMode="None">
<ListView.Resources>
<mAppV2:BoolConverter x:Key="Converter1"/>
</ListView.Resources>
<ListView.ItemTemplate>
<DataTemplate x:DataType="mAppV2:SyncItem">
<Grid Height="50" Background="White" Margin="0" HorizontalAlignment="Stretch" BorderBrush="#FF2E8FDD" BorderThickness="0,0,0,1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<TextBlock Text="{x:Bind name}" FontSize="11" Grid.Column="0" x:Phase="1" Margin="5" VerticalAlignment="Center" Foreground="#FF044071"/>
<CheckBox IsChecked="{Binding isChecked, Mode=TwoWay, Converter={StaticResource Converter1}}" Grid.Column="1" Margin="4" VerticalAlignment="Center" Width="45" Height="45" HorizontalContentAlignment="Center" HorizontalAlignment="Center" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked">
<ContentControl>
<Image Source="Assets/unchecked_checkbox.png"/>
</ContentControl>
</CheckBox>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter ContentMargin="0" />
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>
My problem is that I want to have a border at the right of the TextBlock inside the Grid, but TextBlock doesn't have a Border Property.
Does anybody know how to achieve this? Thank you.
Upvotes: 2
Views: 3945
Reputation: 596
Yes, TextBlock has not Border property. You have to use the Border control like:
<Border BorderThickness="1">
<TextBlock Text="abc" />
</Border>
It works same as in WPF. Here is a tutorial: http://www.wpf-tutorial.com/misc-controls/the-border-control/
Upvotes: 7