Halfwit Loses Dynamic Columns

The next version of my WPF-based Twitter client Halfwit is going to lose a feature.

Dynamic columns in Halfwit

Currently it supports something I call "dynamic columns", in that when you widen the window the view switches from a single vertical column to a wrapping grid of tweets. The idea was to fit more tweets on the screen if you had the space to do so, but the feature came at a cost.

To make the view wrap, I changed the default ItemsPanelTemplate for the main ListBox from a virtualizing StackPanel to a non-virtualizing WrapPanel. Here's the XAML for the "tweets" ListBox:

<ListBox 
    x:Name="tweetList"
    HorizontalContentAlignment="Stretch"
    ItemsSource="{Binding Source={StaticResource TweetsView}}" 
    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
    SelectedItem="{Binding SelectedItem,Mode=TwoWay}"
    >
    <ListBox.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel Orientation="Horizontal" IsItemsHost="True" />
        </ItemsPanelTemplate>
    </ListBox.ItemsPanel>
</ListBox>

What does that mean? Well, it means two things:

  1. The items are arranged horizontally, and when they reach the right edge of the ListBox they "wrap" around to the next row. This means that you get a grid-like layout but still have all the benefits of a ListBox.

  2. Halfwit has to store in memory all of the items rather than just the ones you can see on the screen at any given time. That's what "virtualization" is. That means that Halfwit's memory usage was higher than it should've been, and that the time it takes to render a list (for example, when you switch from the "home" timeline to the "mentions" timeline) was unacceptably high.

I asked the question on Twitter, and (sorry @tobin) the majority of users don't use the dynamic column feature. Given the costs vs the benefits of the feature, I've decided to drop it from the next release. That means that Halfwit will use less memory and perform a little better when you switch views.

I'm not sure when the next version will be released - I have a new SSD coming for my home PC this weekend, which will probably keep me occupied for a while. Look for an update in the next couple of weeks.

halfwit wpf ui
Posted by: Matt Hamilton
Last revised: 19 Apr, 2024 07:43 PM History

Comments

No comments yet. Be the first!

No new comments are allowed on this post.