Isaiah Nelson
Isaiah Nelson

Reputation: 2490

How can one make a Progress Tracker in WPF?

It seems general web design has the concept of a control known as a Progress Tracker, but I cannot find anything regarding such a control in WPF, let alone a tutorial on how to begin going about making one from scratch. It's possible that the Progress Tracker is called something else entirely in XAML but any amount of searching I have done so far has returned very little.

What I would like is a tutorial, but if no one knows of one off-hand, then does anyone have any suggestions for how to create one using a stock WPF control?

Any code examples would be appreciated as I don't know where to begin.

Upvotes: 3

Views: 464

Answers (1)

BradleyDotNET
BradleyDotNET

Reputation: 61369

You would definitely have to roll your own, but it shouldn't be too hard.

At its essence, you would need an ItemsControl (probably with a Horizontal StackPanel as the TemplatePanel) and a user control representing a single "stage". Then you could bind the text, etc. of the user control and as the user progressed set a "status" variable on it to change the color, perform animations, etc.

The items control would looks like this:

<ItemsControl ...>
    <ItemsControl.ItemsPanel>
        <ItemsPanelTemplate>
            <StackPanel Orientation="Horizontal"/>
        </ItemsPanelTemplate>
    </ItemsControl.ItemsPanel>
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <local:ProgressTrackerItem Label="{Binding StepLabel}" Status="{Binding StepStatus}"..../>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

Technically you wouldn't have to use a user control, but I feel it makes for a nice reusable chunk in this instance.

Upvotes: 3

Related Questions