From wpf-dev-pack
Displays 0-based collection indices as 1-based numbers in WPF Slider controls using MVVM. Use for user-friendly slice/page displays while maintaining internal 0-based indexing.
npx claudepluginhub christian289/dotnet-with-claudecode --plugin wpf-dev-packThis skill uses the workspace's default tool permissions.
> **MVVM Framework Rule**: `.claude/rules/dotnet/wpf/mvvm-framework.md` 설정에 따라 코드 스타일이 결정됩니다.
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
MVVM Framework Rule:
.claude/rules/dotnet/wpf/mvvm-framework.md설정에 따라 코드 스타일이 결정됩니다. Prism 9 사용 시 → PRISM.md 참조
When displaying collection indices with a slider, internally using 0-based index but displaying as 1-based to users is a common requirement.
Maximum is set to TotalCount, it exceeds the valid rangepublic partial class ViewerViewModel : ObservableObject
{
// Internal index (0-based)
[NotifyPropertyChangedFor(nameof(SliceDisplayNumber))]
[ObservableProperty] private int _currentSliceIndex;
// Total count
[NotifyPropertyChangedFor(nameof(MaxSliceIndex))]
[ObservableProperty] private int _totalSliceCount;
/// <summary>
/// Slider Maximum value (0-based index maximum)
/// </summary>
public int MaxSliceIndex => Math.Max(0, TotalSliceCount - 1);
/// <summary>
/// User display number (1-based)
/// </summary>
public int SliceDisplayNumber => CurrentSliceIndex + 1;
}
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Current number (1-based display) -->
<TextBlock Grid.Column="0"
Text="{Binding SliceDisplayNumber}" />
<!-- Slider (0-based index, Maximum is Count-1) -->
<Slider Grid.Column="1"
Minimum="0"
Maximum="{Binding MaxSliceIndex}"
Value="{Binding CurrentSliceIndex}" />
<!-- Total count -->
<TextBlock Grid.Column="2"
Text="{Binding TotalSliceCount}" />
</Grid>
| Property | Value Range | Purpose |
|---|---|---|
CurrentSliceIndex | 0 ~ (Count-1) | Internal logic, Slider Value |
MaxSliceIndex | Count-1 | Slider Maximum |
SliceDisplayNumber | 1 ~ Count | User display |
TotalSliceCount | Count | Total count display |
The [NotifyPropertyChangedFor] attribute automatically raises PropertyChanged for computed properties when the source property changes.
// When CurrentSliceIndex changes, SliceDisplayNumber also raises PropertyChanged
[NotifyPropertyChangedFor(nameof(SliceDisplayNumber))]
[ObservableProperty] private int _currentSliceIndex;
// When TotalSliceCount changes, MaxSliceIndex also raises PropertyChanged
[NotifyPropertyChangedFor(nameof(MaxSliceIndex))]
[ObservableProperty] private int _totalSliceCount;