Stylet/Samples/Stylet.Samples.RedditBrowser/Pages/PostCommentsView.xaml

28 lines
1.6 KiB
XML

<UserControl x:Class="Stylet.Samples.RedditBrowser.Pages.PostCommentsView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:redditapi="clr-namespace:Stylet.Samples.RedditBrowser.RedditApi"
xmlns:s="https://github.com/canton7/Stylet"
xmlns:uc="clr-namespace:Stylet.Samples.RedditBrowser.UserControls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<DockPanel>
<Button DockPanel.Dock="Top" HorizontalAlignment="Left" Command="{s:Action GoBack}">Back</Button>
<uc:StretchingTreeView ItemsSource="{Binding CommentCollection.Comments}" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<uc:StretchingTreeView.Resources>
<Style TargetType="uc:StretchingTreeViewItem">
<Setter Property="ToggleButtonVerticalAlignment" Value="Top"/>
</Style>
<HierarchicalDataTemplate DataType="{x:Type redditapi:Comment}" ItemsSource="{Binding Replies}">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Author}" FontWeight="Bold"/>
<TextBlock Text="{Binding Body}" TextWrapping="Wrap"/>
</StackPanel>
</HierarchicalDataTemplate>
</uc:StretchingTreeView.Resources>
</uc:StretchingTreeView>
</DockPanel>
</UserControl>