+
+## About
+
+WPFDevelopers provides reusable controls, application-wide themes, and interactive samples for WPF projects. It supports target frameworks from .NET Framework 4.0 through .NET 10. See the [quick start guide](docs/en/getting-started.md) for framework and environment details.
+
+| Themes | Controls | Samples |
+| --- | --- | --- |
+| Light / Dark themes and customizable accent colors | Buttons, inputs, navigation, charts, windows, and more | Sample applications with implementation and composition examples |
+
+## Quick start
+
+Install the stable NuGet package:
+
+```powershell
+Install-Package WPFDevelopers
+```
+
+To try the latest features, install the preview package:
+
+```powershell
+Install-Package WPFDevelopers -Pre
+```
+
+Then follow the [quick start guide](docs/en/getting-started.md) to configure `App.xaml` and use the controls.
+
+## Documentation and resources
+
+- [Quick start and supported .NET versions](docs/en/getting-started.md)
+- [MapView guide](docs/en/mapview.md)
+- [Sample project source](src/WPFDevelopers.Samples.Shared/ExampleViews/)
+- [GitHub](https://github.com/WPFDevelopersOrg/WPFDevelopers) · [AtomGit](https://atomgit.com/WPFDevelopersOrg/WPFDevelopers) · [Gitee](https://gitee.com/WPFDevelopersOrg/WPFDevelopers)
+- [中文 README](README-zh.md)
+
+## Control preview
+
+
+
+The full collection of control demos and animated previews is preserved below. Items marked `DEMO` may be sample-only implementations or compositions rather than built-in WD controls; refer to the corresponding source.
+
+
+Show the full demo gallery and community information
+
[中文](https://gitee.com/WPFDevelopersOrg/WPFDevelopers/blob/master/README-zh.md)
@@ -26,6 +90,8 @@
### [Documentation Center → Quick Start](docs/en/getting-started.md)
+The sample navigation marks sample-only implementations and composed effects with a blue-gray `DEMO` badge. These are not built-in WD controls; refer to the sample source. `DEMO` is independent of `NEW` / `UPDATE`, so both badges can appear on the same item.
+
### Visual Studio 2026
System Design
@@ -65,7 +131,7 @@ If you think our open source software is helpful to you, please scan the QR code
### Backers
-
+
### Contributors
@@ -487,7 +553,7 @@ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
----------
-### CropControl
+### ImageCrop
@@ -663,7 +729,7 @@ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
----------
-### WpfPieControl
+### PieSegment
@@ -744,5 +810,4 @@ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
----------
- ~~end~~
-
+
diff --git a/docs/en/getting-started.md b/docs/en/getting-started.md
index 85dc650c..6a87eda4 100644
--- a/docs/en/getting-started.md
+++ b/docs/en/getting-started.md
@@ -17,8 +17,6 @@ WPFDevelopers covers the full spectrum from .NET Framework 4.0 to .NET 10:
- Visual Studio 2026
- .NET Framework 4.0 or later / .NET Core 3.0 or later
----
-
## MapView Guide
If you need to use the map control, start with:
@@ -108,6 +106,107 @@ Then use WD controls:
```
+### ColorPicker Usage
+
+`ColorPicker` remains an inline panel. Its format dropdown selects RGB, HSL, or HEX directly; set `ColorType` to choose the initial format.
+
+```xml
+
+```
+
+Set `DisplayMode="Popup"` on the same `ColorPicker` to show a clickable swatch that opens the panel. The default, `DisplayMode="Inline"`, preserves the existing inline display:
+
+```xml
+
+
+```
+
+- `SelectedColor` is a `Color` and binds two-way by default. Changes are applied immediately, without confirmation.
+- `ShowColorText` defaults to `False`. Enable it to display HEX beside the swatch: `#RRGGBB` for opaque colors, or `#AARRGGBB` otherwise.
+- `SwatchSize` is the swatch side length, defaulting to 18. Use positive values such as 24 or 32; trigger dimensions also include padding and borders.
+- `IsDropDownOpen` supports two-way binding. Click outside or press Esc to close; F4 or Alt+Down toggles the popup. Space opens it when the trigger has focus.
+- Mouse activation opens the panel on release so the popup can capture outside clicks. Outside-click dismissal remains available after changing formats.
+- `ShowColorText`, `SwatchSize`, and `IsDropDownOpen` apply to Popup mode; Inline mode cannot open a popup. Switching `DisplayMode` at runtime closes the popup and preserves the color and format.
+- `SelectedColorChanged` is a bubbling color-change event. Both modes share the color panel and theme resources. In Popup mode, `Width`, `Height`, and `Padding` configure the trigger, not the inner panel.
+
+### GridSplitter Usage
+
+`GridSplitter` is a standard WPF control and does not require the `wd:` prefix. After configuring the theme above, its default style has a transparent background and a centered three-dot grip. Hovering hides the dots and highlights the splitter with the theme color; leaving restores the grip.
+
+> The three-dot grip requires a library version containing this change. Earlier NuGet packages may not include this style.
+
+#### Vertical Splitter: Side-by-Side Panes
+
+Place the splitter in a dedicated `Auto` column and set `Width` and `ResizeDirection="Columns"`:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+#### Horizontal Splitter: Stacked Panes
+
+Place the splitter in a dedicated `Auto` row and set `Height` and `ResizeDirection="Rows"`. The three-dot grip rotates to a horizontal arrangement:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+Configuration notes:
+
+- Set `ResizeDirection` explicitly: `Columns` resizes adjacent columns; `Rows` resizes adjacent rows. The current grip style rotates through the `Rows` trigger, not through the effective direction inferred by `Auto`.
+- `ResizeBehavior="PreviousAndNext"` resizes the rows or columns on either side of the splitter, matching the dedicated row/column layouts above.
+- `ShowsPreview="True"` previews the resize and applies it on release; `False` resizes immediately. Preview mode requires an `AdornerLayer` in the visual tree, which standard WPF windows normally provide.
+- Set `MinWidth` / `MinHeight` on content columns/rows to prevent panes from becoming too small.
+- `Margin="2,0"` adds 2 DIPs on each side; `Margin="0,2"` adds 2 DIPs above and below. Margins on neighboring containers add to this spacing, so prefer configuring the gap on the splitter alone. The transparent background remains hit-testable for dragging.
+- `Foreground` controls the dot color; the hover background uses the theme resource `WD.PrimaryBrush`.
+
+Find the interactive demo under **Basic → GridSplitter** in the sample application. See [GridSplitterExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/GridSplitterExample.xaml) for the source.
+
### MarkdownViewer Usage
`wd:MarkdownViewer` renders Markdown content as rich text in WPF, which is ideal for README files, help documentation, changelogs, and in-app knowledge content. It supports common Markdown elements such as headings, lists, blockquotes, code blocks, tables, links, and images.
@@ -239,6 +338,35 @@ If you need to display a README, help document, release notes, or internal docum
```
+#### Back-to-top and back-to-bottom
+
+Set `ScrollViewerBehavior.IsBackToTopEnabled` and/or `ScrollViewerBehavior.IsBackToBottomEnabled` to `True` on a scrollable control. The corresponding button appears at the bottom-right while the pointer or keyboard focus is within the control, and hides when the content reaches its destination.
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+The behavior can also be set directly on `ScrollViewer`, `WDScrollViewer`, or `TreeView`. For a `Panel`, set it on the containing `ScrollViewer` because panels do not provide scrolling themselves. It does not replace the `ItemsPanel`, so list virtualization is preserved.
+
+Open the **Attached Properties** menu in the sample application to see an interactive example.
+
### 3. Static Resource Styles
```xml
@@ -280,7 +408,9 @@ WD provides a set of theme resources you can reference in XAML:
## Complete Control Catalog
-> **Important**: Controls marked 🟡 Sample-only are defined in `WPFDevelopers.Samples.Shared/Controls/` and are **NOT** part of the NuGet package (`wd:` namespace). They are only available in the sample project. All other controls can be used directly via the `wd:` prefix after NuGet installation.
+> **Important**: Implementations marked 🟡 Sample-only live in the sample project's `Controls/` or `ExampleViews/` folders and are not shipped as built-in WD controls in the NuGet package. They may compose native WPF controls with WD styles, controls, or helpers.
+
+The sample navigation identifies these implementations and composed effects with a blue-gray `DEMO` badge. Hover for an explanation; the tooltip follows the selected language. `NEW` and `UPDATE` remain independent change-status badges and can appear alongside `DEMO`; for example, ActivityFeed can show both `DEMO` and `UPDATE`. Ordinary usage samples for built-in WD controls and helpers do not receive `DEMO`.
### Windows & Navigation
@@ -338,11 +468,11 @@ WD provides a set of theme resources you can reference in XAML:
| `wd:IPEditBox` | NuGet | [IPEditBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/IPEditBoxExample.xaml) | IP address input |
| `wd:MultiSelectComboBox` | NuGet | [MultiSelectComboBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml) | Multi-select combo box |
| 🟡 MultiSelectSearchComboBox | Sample-only | [MultiSelectSearchComboBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml) | Searchable multi-select combo box |
-| `wd:Password` | NuGet | [PasswordExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Passwrod/PasswordExample.xaml) | Password show/hide toggle |
+| 🟡 Password | Sample-only | [PasswordExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Passwrod/PasswordExample.xaml) | Composed password show/hide sample |
| `wd:VerifyCode` | NuGet | [VerifyCodeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/VerifyCodeExample.xaml) | CAPTCHA drawing |
| 🟡 RoundPicker | Sample-only | [RoundPickerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RoundPickerExample.xaml) | Circular color picker |
-| `wd:RulerControl` | NuGet | [RulerControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml) | Ruler control |
-| 🟡 Selector | Sample-only | [SelectorExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SelectorExample.xaml) | Selector control |
+| `wd:RulerControl` | NuGet | [RulerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml) | Ruler control |
+| `wd:ScrollIntoView` | NuGet | [SelectorExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SelectorExample.xaml) | List positioning helper |
| `wd:Dial` | NuGet | [DialExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DialExample.xaml) | Dial pad |
| `wd:GestureUnlock` | NuGet | [GestureUnlockExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml) | Gesture pattern unlock |
| `wd:SvgViewer` | NuGet | [SvgViewerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SvgViewerExample.xaml) | SVG viewer |
@@ -369,14 +499,14 @@ WD provides a set of theme resources you can reference in XAML:
| `wd:ChartLine` | NuGet | [ChartLineExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ChartLineExample.xaml) | Line chart |
| `wd:ChartPie` | NuGet | [ChartPieExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ChartPieExample.xaml) | Pie chart |
| 🟡 Dashboard | Sample-only | [DashboardExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DashboardExample.xaml) | Dashboard gauge (tick marks follow progress) |
-| 🟡 PieControl | Sample-only | [PieControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml) | Pie chart statistics |
+| 🟡 PieSegment | Sample-only | [PieSegmentExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml) | Segmented pie chart sample (distinct from `wd:ChartPie`) |
| `wd:Gauge` | NuGet | [GaugeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml) | Gauge control |
| 🟡 LineChart | Sample-only | [LineChartExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/LineChartExample.xaml) | Line chart (alternate implementation) |
| `wd:CircleProgressBar` | NuGet | [CircleProgressBarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml) | Circular progress bar |
| `wd:Step` | NuGet | [StepExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/StepExample.xaml) | Step wizard |
| `wd:BreadCrumbBar` | NuGet | [BreadCrumbBarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BreadCrumbBarExample.xaml) | Breadcrumb navigation |
| `wd:Pagination` | NuGet | [PaginationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PaginationExample.xaml) | Pagination control |
-| 🟡 TimeLineControl | Sample-only | [TimeLineExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml) | Timeline (Gitee-style) |
+| 🟡 ActivityFeed | Sample-only | [ActivityFeedExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ActivityFeedExample.xaml) | Activity feed (Gitee-style) |
| `wd:Thermometer` | NuGet | [ThermometerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml) | Thermometer |
| `wd:DataGridFilter` | NuGet | [DataGridFilterExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DataGridFilterExample.xaml) | DataGrid column filter engine |
@@ -390,14 +520,64 @@ WD provides a set of theme resources you can reference in XAML:
| `wd:CircleMenu` | NuGet | [CircleMenuExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml) | Circular menu |
| `wd:SixGridView` | NuGet | [SixGirdViewExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SixGirdViewExample.xaml) | Six-column grid layout |
| `wd:WaterfallPanel` | NuGet | [WaterfallPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml) | Waterfall / masonry panel |
+| `wd:WaterfallItemsControl` | NuGet | [WaterfallPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml) | Masonry items control with a scrolling template |
| `wd:VirtualizingWrapPanel` | NuGet | [VirtualizingWrapPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml) | Virtualizing WrapPanel |
| 🟡 TransformLayout | Sample-only | [TransformLayoutExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/TransformLayoutExample.xaml) | Draggable, resizable, rotatable control |
| `wd:DrapView` | NuGet | [DrapViewExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DrapView/DrapViewExample.xaml) | Drag-and-drop view |
| `wd:Spacing` (attached) | NuGet | [SpacingExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml) | Panel child spacing |
| `wd:PanningItems` | NuGet | [PanningItemsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml) | Panning control (touch swipe) |
-| 🟡 ScrollViewerAnimation | Sample-only | [ScrollViewerAnimationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml) | Animated scrollbar |
+| `wd:WDScrollViewer` / `wd:ScrollViewerBehavior` | NuGet | [ScrollViewerAnimationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml) | Animated scrolling and back-to-top helper |
| `wd:IconicThumbnail` | NuGet | [IconicThumbnailExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/IconicThumbnailExample.xaml) | Iconic thumbnail |
+#### WaterfallPanel: responsive columns and virtualization
+
+Scrolling reuses cached item positions and uses per-column binary searches to select nearby items.
+Positions are rebuilt when width, data, or measured realized-item heights change.
+`WDScrollViewer` retains smooth scrolling: consecutive wheel input accumulates its target,
+while direction changes restart from the current offset. Animations last 250ms without a fixed
+40 FPS cap. Actual smoothness depends on item templates and hardware.
+These changes use APIs available in .NET Framework 4.0. Windows 7 requires a compatible
+.NET Framework build; this does not imply Windows 7 support for modern .NET targets.
+
+For data binding, use `WaterfallItemsControl` without an outer `ScrollViewer`:
+
+```xml
+
+
+
+
+
+
+
+```
+
+It inherits `ItemsSource`, `ItemTemplate`, and `ItemTemplateSelector`, enables recycling by default,
+and exposes `Columns`, `MinColumnWidth`, `Spacing`, and `EstimatedItemHeight`.
+Use `ScrollViewer.VerticalScrollBarVisibility` to control the scrollbar.
+A finite host height is still required for virtualization. Use `WaterfallPanel` for direct XAML
+children or custom hosts.
+
+`Columns` defaults to 3. `MinColumnWidth` defaults to 0 (fixed columns).
+A positive `MinColumnWidth` selects `max(1, floor((availableWidth + Spacing) / (MinColumnWidth + Spacing)))`
+columns. A narrow container still has one column, which may be narrower than the minimum.
+`ActualColumns` reports the selected count. With infinite available width, `Columns` is used,
+and the widest natural item width (at least `MinColumnWidth`) determines the column width.
+
+The same panel supports direct XAML children and `ItemsControl.ItemsSource`.
+For UI virtualization, give the host a finite viewport and use an `ItemsControl` template containing
+`ScrollViewer CanContentScroll="True"` with an `ItemsPresenter` as its content.
+Set `VirtualizingStackPanel.IsVirtualizing="True"` and `VirtualizingStackPanel.VirtualizationMode="Recycling"`
+on the `ItemsControl`, and use `WaterfallPanel` as its `ItemsPanel`.
+Do not wrap this host in a vertical `StackPanel` or an outer scroller providing infinite height.
+Without a finite scrolling viewport the panel generates all containers; setting `IsVirtualizing="False"`
+also generates all containers.
+
+Unmeasured items use `EstimatedItemHeight` (default 200). Actual measurements update positions and
+the scroll extent, so distant jumps and asynchronously loaded images may cause layout shifts.
+Reserve a suitable initial height for asynchronous content.
+This is UI, not data, virtualization: metadata storage is O(item count), and layout calculation is
+O(item count × columns). The example includes XAML, MVVM, and a 5000-card virtualization tab.
+
### Animation & Effects
| Control | Source | Example File | Description |
@@ -407,7 +587,7 @@ WD provides a set of theme resources you can reference in XAML:
| `wd:EdgeLight` | NuGet | [EdgeLightExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/EdgeLightExample.xaml) | Edge marquee light |
| 🟡 RainbowButtons | Sample-only | [RainbowButtonsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RainbowButtonsExample.xaml) | Rainbow buttons |
| `wd:Shake` | NuGet | [ShakeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ShakeExample.xaml) | Window shake |
-| 🟡 BubblleControl | Sample-only | [BubblleControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml) | Bubble animation |
+| 🟡 BubbleSelection | Sample-only | [BubbleSelectionExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml) | Bubble selection sample |
| `wd:StarrySky` | NuGet | [StarrySkyExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/StarrySkyExample.xaml) | Starry sky animation |
| 🟡 SnowCanvas | Sample-only | [SnowCanvasExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SnowCanvasExample.xaml) | Christmas tree & snow canvas |
| 🟡 SpeedRockets | Sample-only | [SpeedRocketsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SpeedRockets/SpeedRocketsExample.xaml) | Speed rocket animation |
@@ -435,7 +615,7 @@ WD provides a set of theme resources you can reference in XAML:
| `wd:ScreenCut` | NuGet | [ScreenCutExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml) | Screen capture (pen / arrow annotation) |
| `wd:CropImage` | NuGet | [CropImageExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropImageExample.xaml) | Image cropping |
| `wd:CropAvatar` | NuGet | [CropAvatarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropAvatar/CropAvatarExample.xaml) | Avatar cropping selector |
-| 🟡 CropControl | Sample-only | [CropControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml) | Image nine-grid cutter |
+| 🟡 ImageCrop | Sample-only | [ImageCropExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml) | Image nine-grid tiling effect sample |
| 🟡 CutImage | Sample-only | [CutImageExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CutImageExample.xaml) | User avatar cropping solution |
| `wd:Magnifier` | NuGet | [MagnifierExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MagnifierExample.xaml) | Magnifier |
@@ -455,7 +635,7 @@ WD provides a set of theme resources you can reference in XAML:
| Control | Source | Example File | Description |
|---------|--------|-------------|-------------|
| 🟡 ZooSemy | Sample-only | [ZooSemyExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ZooSemy/ZooSemyExample.xaml) | Skeuomorphic rotary knob (volume) |
-| 🟡 OtherControl | Sample-only | [OtherControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml) | Torch & other fun controls |
+| 🟡 Flame | Sample-only | [FlameExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml) | Flame animation |
| 🟡 Desktop | Sample-only | [DesktopBackground.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Desktop/DesktopBackground.xaml) | Dynamic desktop wallpaper |
| 🟡 AMap | Sample-only | [BingAMapExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Map/BingAMapExample.xaml) | Map integration (Bing / AutoNavi) |
| 🟡 LoginWindow | Sample-only | [LoginExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/LoginWindow/LoginExample.xaml) | Login window template |
diff --git a/docs/zh/getting-started.md b/docs/zh/getting-started.md
index 69d4ef40..307a14b8 100644
--- a/docs/zh/getting-started.md
+++ b/docs/zh/getting-started.md
@@ -17,8 +17,6 @@ WPFDevelopers 覆盖从 .NET Framework 4.0 到 .NET 10 的完整版本线:
- Visual Studio 2026
- .NET Framework 4.0 或更高 / .NET Core 3.0 或更高
----
-
## MapView 专题文档
如果你要使用地图控件,建议直接阅读:
@@ -108,6 +106,107 @@ xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
```
+### ColorPicker 使用方式
+
+`ColorPicker` 保留内嵌面板用法,底部下拉框可直接选择 RGB、HSL 或 HEX,支持通过 `ColorType` 设置初始格式。
+
+```xml
+
+```
+
+同一个 `ColorPicker` 设置 `DisplayMode="Popup"` 后,提供点击色块打开面板的用法;默认 `DisplayMode="Inline"` 保留现有内嵌展示:
+
+```xml
+
+
+```
+
+- `SelectedColor` 为 `Color`,默认双向绑定,修改颜色时立即同步,无需确认。
+- `ShowColorText` 默认为 `False`;启用后在色块右侧显示 HEX,不透明颜色为 `#RRGGBB`,带透明度颜色为 `#AARRGGBB`。
+- `SwatchSize` 为色块边长,默认为 18,可设置为 24、32 等正数;触发器总尺寸还包含 `Padding` 和边框。
+- `IsDropDownOpen` 支持双向绑定;点击外部或按 Esc 关闭,F4 或 Alt+下箭头切换打开状态,也可通过聚焦触发器后按空格打开。
+- 鼠标点击触发器时,在松开后展开面板,以保证外部点击关闭所需的鼠标捕获;切换格式后仍可点击外部关闭。
+- `ShowColorText`、`SwatchSize` 和 `IsDropDownOpen` 用于 Popup 模式,Inline 模式不会打开弹窗。运行时切换 `DisplayMode` 会关闭弹窗并保留颜色和格式。
+- `SelectedColorChanged` 为颜色改变时触发的冒泡事件。两种模式共用取色逻辑及主题资源,控件的 `Width`、`Height` 和 `Padding` 在 Popup 模式下设置触发器尺寸,不影响内部面板。
+
+### GridSplitter 使用方式
+
+`GridSplitter` 是标准 WPF 控件,不需要 `wd:` 前缀。完成上述主题配置后即可使用默认样式:背景透明、居中显示三个圆点,鼠标进入时隐藏圆点并显示主题色分隔条,移出后恢复。
+
+> 三点手柄样式需要使用包含此改动的控件库版本;较早的 NuGet 包可能尚未包含该样式。
+
+#### 垂直分隔条:左右分栏
+
+使用独立的 `Auto` 列放置分隔条,设置 `Width` 和 `ResizeDirection="Columns"`:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+#### 水平分隔条:上下分栏
+
+使用独立的 `Auto` 行放置分隔条,设置 `Height` 和 `ResizeDirection="Rows"`;此时三个圆点会旋转为水平排列:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+配置要点:
+
+- 显式设置 `ResizeDirection`:`Columns` 调整左右列宽,`Rows` 调整上下行高。当前手柄样式通过 `Rows` 触发器旋转三点,不会根据 `Auto` 的实际拖动方向自动旋转。
+- `ResizeBehavior="PreviousAndNext"` 调整分隔条两侧的行或列,适合上述独立行/列布局。
+- `ShowsPreview="True"` 拖动时显示预览,松开后应用尺寸;`False` 则实时调整。预览模式需要所在的可视树中存在 `AdornerLayer`,标准 WPF 窗口通常已提供。
+- 为内容行/列设置 `MinWidth` / `MinHeight`,避免拖动后内容区过小。
+- `Margin="2,0"` 表示左右各留 2 DIP;`Margin="0,2"` 表示上下各留 2 DIP。相邻容器的外边距会叠加,建议统一在分隔条上配置间距。透明背景仍保留拖动命中区域。
+- `Foreground` 控制圆点颜色;悬停背景使用主题资源 `WD.PrimaryBrush`。
+
+交互示例位于示例程序的 **基础控件 → GridSplitter(网格分隔条)**,源码参见 [GridSplitterExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/GridSplitterExample.xaml)。
+
### MarkdownViewer 使用方式
`wd:MarkdownViewer` 用于将 Markdown 文本渲染为 WPF 中的富文本展示,适合展示说明文档、README、日志、知识库内容等。它支持标题、列表、引用、代码块、表格、链接、图片等常见 Markdown 语法。
@@ -243,6 +342,35 @@ public string MarkdownText { get; } = "# WPFDevelopers\n\n- 支持标题\n- 支
```
+#### 回到顶部和回到底部
+
+在可滚动控件上将 `ScrollViewerBehavior.IsBackToTopEnabled` 和/或 `ScrollViewerBehavior.IsBackToBottomEnabled` 设置为 `True`。当光标或键盘焦点进入控件时,对应按钮会显示在控件右下角;到达目标位置后自动隐藏。
+
+```xml
+
+
+
+
+
+
+
+
+
+```
+
+该附加属性也可直接用于 `ScrollViewer`、`WDScrollViewer` 和 `TreeView`。`Panel` 本身不提供滚动能力,应将属性设置在包裹它的 `ScrollViewer` 上。该行为不会修改 `ItemsPanel`,因此不会影响列表虚拟化。
+
+示例程序中可打开 **附加属性** 菜单查看交互示例。
+
### 3. 静态资源样式
```xml
@@ -284,7 +412,9 @@ WD 提供了一套主题资源,可在 XAML 中引用:
## 控件全览
-> **重要说明**:以下列表中带有 🟡 示例专属 标记的控件定义在 `WPFDevelopers.Samples.Shared/Controls/` 目录中,**不**属于 NuGet 包(`wd:` 命名空间),仅在示例项目中可用。其余控件均可通过 NuGet 安装后以 `wd:` 前缀直接使用。
+> **重要说明**:以下列表中带有 🟡 示例专属 标记的实现位于示例项目的 `Controls/` 或 `ExampleViews/` 中,不作为 WD 内置控件随 NuGet 包提供。示例可能组合使用 WPF 原生控件及 WD 样式、控件或辅助功能。
+
+示例导航使用蓝灰色 `DEMO` 标识这些示例专属实现或组合效果。悬停可查看说明,中英文切换时提示同步更新。`NEW`(新增)和 `UPDATE`(更新)仍只表示更新状态,与 `DEMO` 独立,可同时显示;例如“活动记录”可以同时显示 `DEMO` 和 `UPDATE`。WD 内置控件及辅助功能的常规用法示例不加 `DEMO`。
### 窗口与导航
@@ -342,11 +472,11 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:IPEditBox` | NuGet | [IPEditBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/IPEditBoxExample.xaml) | IP 地址输入框 |
| `wd:MultiSelectComboBox` | NuGet | [MultiSelectComboBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectComboBoxExample.xaml) | 下拉多选框 |
| 🟡 MultiSelectSearchComboBox | 示例专属 | [MultiSelectSearchComboBoxExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MultiSelectSearchComboBoxExample.xaml) | 下拉搜索多选框 |
-| `wd:Password` | NuGet | [PasswordExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Passwrod/PasswordExample.xaml) | 密码显示/隐藏切换 |
+| 🟡 Password | 示例专属 | [PasswordExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Passwrod/PasswordExample.xaml) | 密码显示/隐藏组合示例 |
| `wd:VerifyCode` | NuGet | [VerifyCodeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/VerifyCodeExample.xaml) | 验证码绘制 |
| 🟡 RoundPicker | 示例专属 | [RoundPickerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RoundPickerExample.xaml) | 圆形颜色选择器 |
-| `wd:RulerControl` | NuGet | [RulerControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml) | 刻度尺控件 |
-| 🟡 Selector | 示例专属 | [SelectorExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SelectorExample.xaml) | 选择器控件 |
+| `wd:RulerControl` | NuGet | [RulerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml) | 刻度尺控件 |
+| `wd:ScrollIntoView` | NuGet | [SelectorExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SelectorExample.xaml) | 列表定位辅助功能 |
| `wd:Dial` | NuGet | [DialExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DialExample.xaml) | 拨号盘控件 |
| `wd:GestureUnlock` | NuGet | [GestureUnlockExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml) | 手势解锁 |
| `wd:SvgViewer` | NuGet | [SvgViewerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SvgViewerExample.xaml) | SVG 查看器 |
@@ -373,14 +503,14 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:ChartLine` | NuGet | [ChartLineExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ChartLineExample.xaml) | 折线图 |
| `wd:ChartPie` | NuGet | [ChartPieExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ChartPieExample.xaml) | 饼图 |
| 🟡 Dashboard | 示例专属 | [DashboardExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DashboardExample.xaml) | 仪表盘(刻度跟随进度) |
-| 🟡 PieControl | 示例专属 | [PieControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml) | 统计饼图 |
+| 🟡 PieSegment | 示例专属 | [PieSegmentExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml) | 分段饼图示例(区别于 `wd:ChartPie`) |
| `wd:Gauge` | NuGet | [GaugeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/GaugeExample.xaml) | 仪表盘 |
| 🟡 LineChart | 示例专属 | [LineChartExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/LineChartExample.xaml) | 折线图(另一实现) |
| `wd:CircleProgressBar` | NuGet | [CircleProgressBarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CircleProgressBarExample.xaml) | 环形进度条 |
| `wd:Step` | NuGet | [StepExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/StepExample.xaml) | 步骤条向导 |
| `wd:BreadCrumbBar` | NuGet | [BreadCrumbBarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BreadCrumbBarExample.xaml) | 面包屑导航栏 |
| `wd:Pagination` | NuGet | [PaginationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PaginationExample.xaml) | 分页控件 |
-| 🟡 TimeLineControl | 示例专属 | [TimeLineExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml) | 时间轴(仿 Gitee) |
+| 🟡 ActivityFeed | 示例专属 | [ActivityFeedExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ActivityFeedExample.xaml) | 活动记录(仿 Gitee) |
| `wd:Thermometer` | NuGet | [ThermometerExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ThermometerExample.xaml) | 温度计 |
| `wd:DataGridFilter` | NuGet | [DataGridFilterExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DataGridFilterExample.xaml) | DataGrid 列过滤引擎 |
@@ -394,14 +524,80 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:CircleMenu` | NuGet | [CircleMenuExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CircleMenuExample.xaml) | 圆形菜单 |
| `wd:SixGridView` | NuGet | [SixGirdViewExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SixGirdViewExample.xaml) | 六宫格布局 |
| `wd:WaterfallPanel` | NuGet | [WaterfallPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml) | 瀑布流面板 |
+| `wd:WaterfallItemsControl` | NuGet | [WaterfallPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml) | 内置滚动模板的瀑布流集合控件 |
| `wd:VirtualizingWrapPanel` | NuGet | [VirtualizingWrapPanelExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml) | 虚拟化 WrapPanel |
| 🟡 TransformLayout | 示例专属 | [TransformLayoutExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/TransformLayoutExample.xaml) | 可拖拽旋转缩放控件 |
| `wd:DrapView` | NuGet | [DrapViewExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/DrapView/DrapViewExample.xaml) | 拖拽视图控件 |
| `wd:Spacing`(附加属性) | NuGet | [SpacingExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml) | 面板子元素间距 |
| `wd:PanningItems` | NuGet | [PanningItemsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/PanningItemsExample.xaml) | 平移控件 |
-| 🟡 ScrollViewerAnimation | 示例专属 | [ScrollViewerAnimationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml) | 带动画的滚动条 |
+| `wd:WDScrollViewer` / `wd:ScrollViewerBehavior` | NuGet | [ScrollViewerAnimationExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml) | 动画滚动视图与回到顶部辅助功能 |
| `wd:IconicThumbnail` | NuGet | [IconicThumbnailExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/IconicThumbnailExample.xaml) | 图标缩略图 |
+#### WaterfallPanel:响应式列数与虚拟化
+
+瀑布流滚动复用项目位置缓存,并通过列内二分查找选择视口附近的项目;
+宽度、数据或已实现项目的测量高度变化时才重建位置。
+`WDScrollViewer` 保留平滑滚动,连续同向滚轮输入累计目标位置,反向输入从当前位置开始,
+动画时长为 250ms,不再固定限制为 40 FPS。实际流畅度取决于项目模板和设备性能。
+这些优化只使用 .NET Framework 4.0 已有 API;Win7 应选择兼容的 .NET Framework 构建,
+不能因此认为现代 .NET 目标也支持 Win7。
+
+数据绑定场景推荐使用 `WaterfallItemsControl`,不需要再套外层 `ScrollViewer`:
+
+```xml
+
+
+
+
+
+
+
+```
+
+它继承 `ItemsControl` 的 `ItemsSource`、`ItemTemplate`、`ItemTemplateSelector`,
+默认启用容器回收,并提供 `Columns`、`MinColumnWidth`、`Spacing`、`EstimatedItemHeight`。
+通过 `ScrollViewer.VerticalScrollBarVisibility` 控制滚动条,仍需由父布局提供有限高度才能虚拟化。
+直接 XAML 子项或自行配置宿主时继续使用 `WaterfallPanel`。
+
+`Columns` 默认为 3;`MinColumnWidth` 默认为 0,保留固定列数。
+设置 `MinColumnWidth="200"` 后,列数按 `floor((可用宽度 + Spacing) / (MinColumnWidth + Spacing))`
+计算,最少一列。容器不足最小列宽时,单列会缩小到容器宽度;`ActualColumns` 可读取当前列数。
+无限宽度下使用 `Columns`,按子项最大自然宽度(且不小于 `MinColumnWidth`)计算列宽。
+
+同一个 `WaterfallPanel` 支持直接 XAML 子元素和 `ItemsControl.ItemsSource`。
+真正的 UI 虚拟化需要有限视口,并由 `ScrollViewer` 通过 `CanContentScroll="True"`
+将滚动交给面板。例如:
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+```
+
+不要将该虚拟化宿主放入垂直 `StackPanel` 或另一个提供无限高度的外层滚动容器;
+缺少有限视口或滚动协作时会退回全部容器布局。`IsVirtualizing="False"` 也会生成全部容器。
+未测量项使用 `EstimatedItemHeight`(默认 200),测得真实高度后会修正布局与滚动范围,
+因此远距离跳转、图片异步加载时位置可能变化。异步内容应预留合理高度。
+这是容器虚拟化,不是数据虚拟化:布局元数据仍随项目数增长,布局计算为 O(项目数 × 列数)。
+示例包含 XAML、MVVM 和 5000 个不同高度卡片的虚拟化演示。
+
### 动画与特效
| 控件名 | 来源 | 示例文件 | 说明 |
@@ -411,7 +607,7 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:EdgeLight` | NuGet | [EdgeLightExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/EdgeLightExample.xaml) | 边框跑马灯 |
| 🟡 RainbowButtons | 示例专属 | [RainbowButtonsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/RainbowButtonsExample.xaml) | 彩虹按钮 |
| `wd:Shake` | NuGet | [ShakeExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ShakeExample.xaml) | 窗体抖动 |
-| 🟡 BubblleControl | 示例专属 | [BubblleControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml) | 泡泡动画控件 |
+| 🟡 BubbleSelection | 示例专属 | [BubbleSelectionExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml) | 气泡选择示例 |
| `wd:StarrySky` | NuGet | [StarrySkyExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/StarrySkyExample.xaml) | 星空动画 |
| 🟡 SnowCanvas | 示例专属 | [SnowCanvasExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SnowCanvasExample.xaml) | 圣诞树雪花 Canvas |
| 🟡 SpeedRockets | 示例专属 | [SpeedRocketsExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/SpeedRockets/SpeedRocketsExample.xaml) | 加速火箭动画 |
@@ -439,7 +635,7 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| `wd:ScreenCut` | NuGet | [ScreenCutExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml) | 截屏工具(画笔/箭头标注) |
| `wd:CropImage` | NuGet | [CropImageExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropImageExample.xaml) | 图片裁剪 |
| `wd:CropAvatar` | NuGet | [CropAvatarExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropAvatar/CropAvatarExample.xaml) | 头像裁剪选择器 |
-| 🟡 CropControl | 示例专属 | [CropControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml) | 图片切九宫格控件 |
+| 🟡 ImageCrop | 示例专属 | [ImageCropExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml) | 图片九宫格分块效果示例 |
| 🟡 CutImage | 示例专属 | [CutImageExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/CutImageExample.xaml) | 用户头像裁剪方案 |
| `wd:Magnifier` | NuGet | [MagnifierExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/MagnifierExample.xaml) | 放大镜 |
@@ -459,7 +655,7 @@ WD 提供了一套主题资源,可在 XAML 中引用:
| 控件名 | 来源 | 示例文件 | 说明 |
|--------|------|----------|------|
| 🟡 ZooSemy | 示例专属 | [ZooSemyExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/ZooSemy/ZooSemyExample.xaml) | 拟物旋转按钮(音量旋钮) |
-| 🟡 OtherControl | 示例专属 | [OtherControlExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml) | 火炬等趣味控件 |
+| 🟡 Flame | 示例专属 | [FlameExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml) | 火苗动画 |
| 🟡 Desktop | 示例专属 | [DesktopBackground.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Desktop/DesktopBackground.xaml) | 动态桌面壁纸(视频播放) |
| 🟡 AMap | 示例专属 | [BingAMapExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/Map/BingAMapExample.xaml) | 地图集成(Bing/高德) |
| 🟡 LoginWindow | 示例专属 | [LoginExample.xaml](../../src/WPFDevelopers.Samples.Shared/ExampleViews/LoginWindow/LoginExample.xaml) | 登录窗口模板 |
diff --git a/src/Microsoft.Windows.Shell/WindowChromeWorker.cs b/src/Microsoft.Windows.Shell/WindowChromeWorker.cs
index ec9b940b..5f0a5d6d 100644
--- a/src/Microsoft.Windows.Shell/WindowChromeWorker.cs
+++ b/src/Microsoft.Windows.Shell/WindowChromeWorker.cs
@@ -319,13 +319,13 @@ private IntPtr _HandleNCHitTest(WM uMsg, IntPtr wParam, IntPtr lParam, out bool
{
Point point = new Point((double)Utility.GET_X_LPARAM(lParam), (double)Utility.GET_Y_LPARAM(lParam));
Rect deviceRectangle = this._GetWindowRect();
- HT ht = this._HitTestNca(DpiHelper.DeviceRectToLogical(deviceRectangle), DpiHelper.DevicePixelsToLogical(point));
+ Point windowOrigin = this._window.PointFromScreen(deviceRectangle.TopLeft);
+ Point windowEnd = this._window.PointFromScreen(deviceRectangle.BottomRight);
+ Point logicalPoint = this._window.PointFromScreen(point);
+ HT ht = this._HitTestNca(new Rect(windowOrigin, windowEnd), logicalPoint);
if (ht != HT.CLIENT)
{
- Point point2 = point;
- point2.Offset(-deviceRectangle.X, -deviceRectangle.Y);
- point2 = DpiHelper.DevicePixelsToLogical(point2);
- IInputElement inputElement = this._window.InputHitTest(point2);
+ IInputElement inputElement = this._window.InputHitTest(logicalPoint);
if (inputElement != null && WindowChrome.GetIsHitTestVisibleInChrome(inputElement))
{
ht = HT.CLIENT;
@@ -578,7 +578,7 @@ private void _SetRoundingRegion(WINDOWPOS? wp)
try
{
double num3 = Math.Min(size.Width, size.Height);
- double num4 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopLeft, 0.0)).X;
+ double num4 = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.CornerRadius.TopLeft, 0.0)).X;
num4 = Math.Min(num4, num3 / 2.0);
if (WindowChromeWorker._IsUniform(this._chromeInfo.CornerRadius))
{
@@ -587,17 +587,17 @@ private void _SetRoundingRegion(WINDOWPOS? wp)
else
{
intPtr = WindowChromeWorker._CreateRoundRectRgn(new Rect(0.0, 0.0, size.Width / 2.0 + num4, size.Height / 2.0 + num4), num4);
- double num5 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.TopRight, 0.0)).X;
+ double num5 = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.CornerRadius.TopRight, 0.0)).X;
num5 = Math.Min(num5, num3 / 2.0);
Rect region = new Rect(0.0, 0.0, size.Width / 2.0 + num5, size.Height / 2.0 + num5);
region.Offset(size.Width / 2.0 - num5, 0.0);
WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region, num5);
- double num6 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomLeft, 0.0)).X;
+ double num6 = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.CornerRadius.BottomLeft, 0.0)).X;
num6 = Math.Min(num6, num3 / 2.0);
Rect region2 = new Rect(0.0, 0.0, size.Width / 2.0 + num6, size.Height / 2.0 + num6);
region2.Offset(0.0, size.Height / 2.0 - num6);
WindowChromeWorker._CreateAndCombineRoundRectRgn(intPtr, region2, num6);
- double num7 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.CornerRadius.BottomRight, 0.0)).X;
+ double num7 = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.CornerRadius.BottomRight, 0.0)).X;
num7 = Math.Min(num7, num3 / 2.0);
Rect region3 = new Rect(0.0, 0.0, size.Width / 2.0 + num7, size.Height / 2.0 + num7);
region3.Offset(size.Width / 2.0 - num7, size.Height / 2.0 - num7);
@@ -661,8 +661,8 @@ private void _ExtendGlassFrame()
return;
}
this._hwndSource.CompositionTarget.BackgroundColor = Colors.Transparent;
- Point point = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Left, this._chromeInfo.GlassFrameThickness.Top));
- Point point2 = DpiHelper.LogicalPixelsToDevice(new Point(this._chromeInfo.GlassFrameThickness.Right, this._chromeInfo.GlassFrameThickness.Bottom));
+ Point point = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.GlassFrameThickness.Left, this._chromeInfo.GlassFrameThickness.Top));
+ Point point2 = this._hwndSource.CompositionTarget.TransformToDevice.Transform(new Point(this._chromeInfo.GlassFrameThickness.Right, this._chromeInfo.GlassFrameThickness.Bottom));
MARGINS margins = new MARGINS
{
cxLeftWidth = (int)Math.Ceiling(point.X),
diff --git a/src/Resources.props b/src/Resources.props
index b41fbb04..7fdeed8c 100644
--- a/src/Resources.props
+++ b/src/Resources.props
@@ -80,6 +80,9 @@
Resources\Svg\%(Filename)%(Extension)
+
+ Resources\MenuIcons\%(Filename)%(Extension)
+ WPFDevelopers.Samples
diff --git a/src/WPFDevelopers.Net40/Themes/Theme.xaml b/src/WPFDevelopers.Net40/Themes/Theme.xaml
index db40b038..20177e00 100644
--- a/src/WPFDevelopers.Net40/Themes/Theme.xaml
+++ b/src/WPFDevelopers.Net40/Themes/Theme.xaml
@@ -56,6 +56,7 @@
M0.99999994,0.99999994 L0.99999994,9 9,9 9,0.99999994 z M0,0 L10,0 10,10 0,10 zM1,3 L1,9 7,9 7,3 z M3,0.99999994 L3,2 8,2 8,7 9,7 9,0.99999994 z M2,0 L10,0 10,8 8,8 8,10 0,10 0,2 2,2 zM 1301 69.6875 L 1305.3049 74 L 1300.9375 78.5313 L 1301.6324 79.2263 L 1306 74.735 L 1310.4263 79.2613 L 1311.1563 78.5313 L 1306.7 74 L 1310.9375 69.6875 L 1310.2075 68.9575 L 1306 73.265 L 1301.6949 68.9925 L 1301 69.6875 Z
+ M10,31 C10,31 1.8,21.6 1.8,13.2 C1.8,7.1 5.3,3.2 10,3.2 C14.7,3.2 18.2,7.1 18.2,13.2 C18.2,21.6 10,31 10,31 ZM 426 726 L 810 342 L 750 280 L 426 666 L 274 514 L 214 574 Z M 512 86 C 748 86 938 276 938 512 C 938 748 748 938 512 938 C 276 938 86 748 86 512 C 86 276 276 86 512 86 ZM512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM576 128h-128v128h128v-128zM576 320h-128v448h128v-448zM512 960c-281.6 0-512-230.4-512-512s230.4-512 512-512 512 230.4 512 512-230.4 512-512 512zM576 128h-128v448h128v-448zM576 640h-128v128h128v-128z
@@ -101,6 +102,11 @@
M13 2h-1v1.5c0 .28-.22.5-.5.5h-2c-.28 0-.5-.22-.5-.5V2H6v1.5c0 .28-.22.5-.5.5h-2c-.28 0-.5-.22-.5-.5V2H2c-.55 0-1 .45-1 1v11c0 .55.45 1 1 1h11c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 12H2V5h11v9zM5 3H4V1h1v2zm6 0h-1V1h1v2zM6 7H5V6h1v1zm2 0H7V6h1v1zm2 0H9V6h1v1zm2 0h-1V6h1v1zM4 9H3V8h1v1zm2 0H5V8h1v1zm2 0H7V8h1v1zm2 0H9V8h1v1zm2 0h-1V8h1v1zm-8 2H3v-1h1v1zm2 0H5v-1h1v1zm2 0H7v-1h1v1zm2 0H9v-1h1v1zm2 0h-1v-1h1v1zm-8 2H3v-1h1v1zm2 0H5v-1h1v1zm2 0H7v-1h1v1zm2 0H9v-1h1v1zM20 109.9988C20 93.43 33.4314 79.998 50 79.998H80L80 99.998H50C44.4772 99.998 40 104.476 40 109.9988L40 249.9988C40 255.5216 44.4772 259.9988 50 259.9988L190 259.9988C195.5228 259.9988 200 255.5216 200 249.9988V219.9996H110C93.4316 219.9996 80 206.5682 80 189.9996V50C80 33.432 93.4316 20 110 20H250C266.568 20 280 33.432 280 50V189.9996C280 206.5682 266.568 219.9996 250 219.9996H220V249.9988C220 266.5674 206.568 279.9988 190 279.9988H50C33.4314 279.9988 20 266.5674 20 249.9988V109.9988zM100 189.9996C100 195.5224 104.4772 199.9996 110 199.9996H250C255.522 199.9996 260 195.5224 260 189.9996V50C260 44.476 255.522 40 250 40H110C104.4772 40 100 44.476 100 50V189.9996zM0,0 L10,0 L6,5 L6,10 L4,10 L4,5 L0,0
+ M396 712 L233 512 L178 580 L396 848 L861 272 L807 204 Z
+ M 1,7 A 6,6 0 0 0 13,7
+ M854,346 512,0 170,346 232,404 470,166 470,684 554,684 554,166 794,404z
+ M170,678 512,1024 854,678 792,620 554,858 554,340 470,340 470,858 232,620z
+ M1.5,0 A1.5,1.5 0 1 1 1.5,3 A1.5,1.5 0 1 1 1.5,0 Z M1.5,6 A1.5,1.5 0 1 1 1.5,9 A1.5,1.5 0 1 1 1.5,6 Z M1.5,12 A1.5,1.5 0 1 1 1.5,15 A1.5,1.5 0 1 1 1.5,12 Z
@@ -368,6 +374,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1202,8 +1223,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1215,8 +1246,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1740,7 +1781,7 @@
-
+
@@ -2344,6 +2385,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
@@ -6567,6 +6832,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -7405,6 +7804,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1204,8 +1225,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1217,8 +1248,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
@@ -1742,7 +1783,7 @@
-
+
@@ -2346,6 +2387,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
@@ -6599,6 +6864,57 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -7437,6 +7836,30 @@
+
+
-
-
+
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLineItem.cs b/src/WPFDevelopers.Samples.Shared/Controls/ActivityFeed/ActivityFeedItem.cs
similarity index 83%
rename from src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLineItem.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/ActivityFeed/ActivityFeedItem.cs
index c34a0fd3..b33c9b90 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLineItem.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/ActivityFeed/ActivityFeedItem.cs
@@ -4,36 +4,36 @@
namespace WPFDevelopers.Samples.Controls
{
- public class TimeLineItem : Control
+ public class ActivityFeedItem : Control
{
public static readonly DependencyProperty IsBottomProperty =
- DependencyProperty.Register("IsBottom", typeof(bool), typeof(TimeLineItem), new PropertyMetadata(false));
+ DependencyProperty.Register("IsBottom", typeof(bool), typeof(ActivityFeedItem), new PropertyMetadata(false));
public static readonly DependencyProperty ItemTypeProperty =
- DependencyProperty.Register("ItemType", typeof(ItemTypeEnum), typeof(TimeLineItem));
+ DependencyProperty.Register("ItemType", typeof(ItemTypeEnum), typeof(ActivityFeedItem));
public static readonly DependencyProperty TextProperty =
- DependencyProperty.Register("Text", typeof(string), typeof(TimeLineItem),
+ DependencyProperty.Register("Text", typeof(string), typeof(ActivityFeedItem),
new PropertyMetadata(string.Empty));
public static readonly DependencyProperty HeadProperty =
- DependencyProperty.Register("Head", typeof(string), typeof(TimeLineItem),
+ DependencyProperty.Register("Head", typeof(string), typeof(ActivityFeedItem),
new PropertyMetadata(string.Empty));
public static readonly DependencyProperty CommonTemplateProperty =
- DependencyProperty.Register("CommonTemplate", typeof(DataTemplate), typeof(TimeLineItem));
+ DependencyProperty.Register("CommonTemplate", typeof(DataTemplate), typeof(ActivityFeedItem));
public static readonly DependencyProperty TextTemplateProperty =
- DependencyProperty.Register("TextTemplate", typeof(DataTemplate), typeof(TimeLineItem));
+ DependencyProperty.Register("TextTemplate", typeof(DataTemplate), typeof(ActivityFeedItem));
public static readonly DependencyProperty BackgroundColorProperty =
- DependencyProperty.Register("BackgroundColor", typeof(Brush), typeof(TimeLineItem),
+ DependencyProperty.Register("BackgroundColor", typeof(Brush), typeof(ActivityFeedItem),
new PropertyMetadata(null));
- static TimeLineItem()
+ static ActivityFeedItem()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(TimeLineItem),
- new FrameworkPropertyMetadata(typeof(TimeLineItem)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ActivityFeedItem),
+ new FrameworkPropertyMetadata(typeof(ActivityFeedItem)));
}
public bool IsBottom
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleCanvas.cs b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleCanvas.cs
similarity index 98%
rename from src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleCanvas.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleCanvas.cs
index 471f5694..b6ed6a11 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleCanvas.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleCanvas.cs
@@ -4,7 +4,7 @@
namespace WPFDevelopers.Samples.Controls
{
- public class BubblleCanvas : Canvas
+ public class BubbleCanvas : Canvas
{
private double _bubbleItemX;
private double _bubbleItemY;
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.cs b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.cs
similarity index 89%
rename from src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.cs
index 5096083b..5eaeb1f6 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.cs
@@ -12,16 +12,16 @@ namespace WPFDevelopers.Samples.Controls
[TemplatePart(Name = BorderTemplateName, Type = typeof(Border))]
[TemplatePart(Name = EllipseTemplateName, Type = typeof(Ellipse))]
[TemplatePart(Name = RotateTransformTemplateName, Type = typeof(RotateTransform))]
- public class BubblleControl : Control
+ public class BubbleSelection : Control
{
private const string BorderTemplateName = "PART_Border";
private const string EllipseTemplateName = "PART_Ellipse";
private const string RotateTransformTemplateName = "PART_EllipseRotateTransform";
private const string ListBoxTemplateName = "PART_ListBox";
- private static readonly Type _typeofSelf = typeof(BubblleControl);
+ private static readonly Type _typeofSelf = typeof(BubbleSelection);
- private ObservableCollection _items = new ObservableCollection();
+ private ObservableCollection _items = new ObservableCollection();
private Border _border;
@@ -31,13 +31,13 @@ public class BubblleControl : Control
private ItemsControl _listBox;
private static RoutedCommand _clieckCommand;
- class BubblleItem
+ class BubbleItem
{
public string Text { get; set; }
public Brush Bg { get; set; }
}
- static BubblleControl()
+ static BubbleSelection()
{
InitializeCommands();
DefaultStyleKeyProperty.OverrideMetadata(_typeofSelf, new FrameworkPropertyMetadata(_typeofSelf));
@@ -72,7 +72,7 @@ public static RoutedCommand ClickCommand
private static void OnClickCommand(object sender, ExecutedRoutedEventArgs e)
{
- var ctrl = sender as BubblleControl;
+ var ctrl = sender as BubbleSelection;
ctrl.SetValue(SelectedTextPropertyKey, e.Parameter?.ToString());
ctrl.RaiseEvent(new RoutedEventArgs(ClickEvent));
@@ -95,11 +95,11 @@ public string SelectedText
get { return (string)GetValue(SelectedTextProperty); }
}
public static readonly DependencyProperty BorderBackgroundProperty =
- DependencyProperty.Register("BorderBackground", typeof(Brush), typeof(BubblleControl),
+ DependencyProperty.Register("BorderBackground", typeof(Brush), typeof(BubbleSelection),
new PropertyMetadata(null));
public static readonly DependencyProperty EarthBackgroundProperty =
- DependencyProperty.Register("EarthBackground", typeof(Brush), typeof(BubblleControl),
+ DependencyProperty.Register("EarthBackground", typeof(Brush), typeof(BubbleSelection),
new PropertyMetadata(Brushes.DarkOrchid));
public Brush BorderBackground
{
@@ -116,7 +116,7 @@ public Brush EarthBackground
#region Property
public static readonly DependencyProperty ItemsSourceProperty =
- DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(BubblleControl), new PropertyMetadata(null, OnItemsSourcePropertyChanged));
+ DependencyProperty.Register("ItemsSource", typeof(IEnumerable), typeof(BubbleSelection), new PropertyMetadata(null, OnItemsSourcePropertyChanged));
public IEnumerable ItemsSource
{
get { return (IEnumerable)GetValue(ItemsSourceProperty); }
@@ -125,7 +125,7 @@ public IEnumerable ItemsSource
private static void OnItemsSourcePropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
{
- var ctrl = obj as BubblleControl;
+ var ctrl = obj as BubbleSelection;
var newValue = e.NewValue as IEnumerable;
if (newValue == null)
@@ -136,7 +136,7 @@ private static void OnItemsSourcePropertyChanged(DependencyObject obj, Dependenc
foreach (var item in newValue)
{
- ctrl._items.Add(new BubblleItem { Text = item, Bg = Helper.RandomBrush() });
+ ctrl._items.Add(new BubbleItem { Text = item, Bg = Helper.RandomBrush() });
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.xaml b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.xaml
similarity index 93%
rename from src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.xaml
rename to src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.xaml
index 49c6c1e5..376d7c35 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/BubblleControl/BubblleControl.xaml
+++ b/src/WPFDevelopers.Samples.Shared/Controls/BubbleSelection/BubbleSelection.xaml
@@ -5,9 +5,9 @@
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers">
-
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.cs b/src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.cs
similarity index 93%
rename from src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.cs
index b3659df0..411be29b 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.cs
@@ -11,23 +11,23 @@
namespace WPFDevelopers.Samples.Controls
{
[TemplatePart(Name = UniformGridTemplateName, Type = typeof(UniformGrid))]
- public class CropControl : Control
+ public class ImageCrop : Control
{
private const string UniformGridTemplateName = "PART_UniformGrid";
public static readonly DependencyProperty ImageSourceProperty =
- DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(CropControl),
+ DependencyProperty.Register("ImageSource", typeof(ImageSource), typeof(ImageCrop),
new PropertyMetadata(null));
public static readonly DependencyProperty RowColumnProperty =
- DependencyProperty.Register("RowColumn", typeof(int), typeof(CropControl), new PropertyMetadata(3));
+ DependencyProperty.Register("RowColumn", typeof(int), typeof(ImageCrop), new PropertyMetadata(3));
private UniformGrid _uniformGrid;
- static CropControl()
+ static ImageCrop()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(CropControl),
- new FrameworkPropertyMetadata(typeof(CropControl)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageCrop),
+ new FrameworkPropertyMetadata(typeof(ImageCrop)));
}
public ImageSource ImageSource
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.xaml b/src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.xaml
similarity index 73%
rename from src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.xaml
rename to src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.xaml
index b32dd3dd..fc7e4f5c 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/CropControl/CropControl.xaml
+++ b/src/WPFDevelopers.Samples.Shared/Controls/ImageCrop/ImageCrop.xaml
@@ -4,12 +4,12 @@
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers">
-
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/NavigateMenu/NavigateMenu.xaml b/src/WPFDevelopers.Samples.Shared/Controls/NavigateMenu/NavigateMenu.xaml
index eac27113..ff7252fa 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/NavigateMenu/NavigateMenu.xaml
+++ b/src/WPFDevelopers.Samples.Shared/Controls/NavigateMenu/NavigateMenu.xaml
@@ -20,6 +20,7 @@
Background="Transparent"
DisplayMemberPath="{Binding DisplayMemberPath, RelativeSource={RelativeSource AncestorType={x:Type controls:NavigateMenu}}}"
ItemsSource="{TemplateBinding ItemsSource}"
+ ItemTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource AncestorType={x:Type controls:NavigateMenu}}}"
ScrollViewer.VerticalScrollBarVisibility="Hidden"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource AncestorType={x:Type controls:NavigateMenu}}}"
SelectedItem="{Binding SelectedItem, RelativeSource={RelativeSource AncestorType={x:Type controls:NavigateMenu}}}">
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/Others/FireControl.cs b/src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.cs
similarity index 67%
rename from src/WPFDevelopers.Samples.Shared/Controls/Others/FireControl.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.cs
index 71807744..74e857ec 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/Others/FireControl.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.cs
@@ -3,16 +3,16 @@
namespace WPFDevelopers.Samples.Controls
{
- public class FireControl : Control
+ public class Flame : Control
{
public static readonly DependencyProperty IsStartProperty =
- DependencyProperty.Register("IsStart", typeof(bool), typeof(FireControl),
+ DependencyProperty.Register("IsStart", typeof(bool), typeof(Flame),
new PropertyMetadata(default(bool)));
- static FireControl()
+ static Flame()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(FireControl),
- new FrameworkPropertyMetadata(typeof(FireControl)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(Flame),
+ new FrameworkPropertyMetadata(typeof(Flame)));
}
public bool IsStart
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/Others/OtherControl.xaml b/src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.xaml
similarity index 96%
rename from src/WPFDevelopers.Samples.Shared/Controls/Others/OtherControl.xaml
rename to src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.xaml
index 3730e1a6..8f7159d1 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/Others/OtherControl.xaml
+++ b/src/WPFDevelopers.Samples.Shared/Controls/Others/Flame.xaml
@@ -4,16 +4,16 @@
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers">
-
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.cs b/src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.cs
similarity index 82%
rename from src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.cs
index c2744da9..e15f795d 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.cs
@@ -5,14 +5,14 @@
namespace WPFDevelopers.Samples.Controls
{
- public class PieControl : Control
+ public class PieSegment : Control
{
public static readonly DependencyProperty PieSegmentModelsProperty =
DependencyProperty.Register("PieSegmentModels", typeof(ObservableCollection),
- typeof(PieControl), new UIPropertyMetadata(OnPieSegmentModelChanged));
+ typeof(PieSegment), new UIPropertyMetadata(OnPieSegmentModelChanged));
public static readonly DependencyProperty ArcThicknessProperty =
- DependencyProperty.Register("ArcThickness", typeof(double), typeof(PieControl), new PropertyMetadata(1.0));
+ DependencyProperty.Register("ArcThickness", typeof(double), typeof(PieSegment), new PropertyMetadata(1.0));
///
/// colors
@@ -20,10 +20,10 @@ public class PieControl : Control
private readonly string[] ColorArray = { "#FDC006", "#607E89", "#2095F2", "#F34336" };
- static PieControl()
+ static PieSegment()
{
- DefaultStyleKeyProperty.OverrideMetadata(typeof(PieControl),
- new FrameworkPropertyMetadata(typeof(PieControl)));
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(PieSegment),
+ new FrameworkPropertyMetadata(typeof(PieSegment)));
}
public ObservableCollection PieSegmentModels
@@ -44,7 +44,7 @@ public double ArcThickness
private static void OnPieSegmentModelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
- var pieControl = d as PieControl;
+ var pieSegment = d as PieSegment;
if (e.NewValue != null)
{
var array = e.NewValue as ObservableCollection;
@@ -52,7 +52,7 @@ private static void OnPieSegmentModelChanged(DependencyObject d, DependencyPrope
foreach (var item in array)
{
var color = new SolidColorBrush(
- (Color)ColorConverter.ConvertFromString(pieControl.ColorArray[array.IndexOf(item)]));
+ (Color)ColorConverter.ConvertFromString(pieSegment.ColorArray[array.IndexOf(item)]));
item.Color = color;
item.StartAngle = angleNum;
item.EndAngle = angleNum + item.Value / 100 * 360;
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.xaml b/src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.xaml
similarity index 91%
rename from src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.xaml
rename to src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.xaml
index b715112a..d9aefa6a 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieControl.xaml
+++ b/src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegment.xaml
@@ -6,15 +6,15 @@
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers">
-
+
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieSegmentModel.cs b/src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegmentModel.cs
similarity index 100%
rename from src/WPFDevelopers.Samples.Shared/Controls/PieControl/PieSegmentModel.cs
rename to src/WPFDevelopers.Samples.Shared/Controls/PieSegment/PieSegmentModel.cs
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/Theme/Theme.cs b/src/WPFDevelopers.Samples.Shared/Controls/Theme/Theme.cs
index 4813b5dd..9e48d243 100644
--- a/src/WPFDevelopers.Samples.Shared/Controls/Theme/Theme.cs
+++ b/src/WPFDevelopers.Samples.Shared/Controls/Theme/Theme.cs
@@ -8,6 +8,11 @@ namespace WPFDevelopers.Samples.Controls
{
public class Theme : ListBox
{
+ private static readonly DependencyProperty CurrentPrimaryColorProperty =
+ DependencyProperty.Register("CurrentPrimaryColor", typeof(Color), typeof(Theme),
+ new PropertyMetadata(default(Color), OnCurrentPrimaryColorChanged));
+
+ private bool _synchronizingSelection;
private readonly List themes = new List
{
@@ -49,7 +54,38 @@ public Theme()
});
}
ItemsSource = ThemeItems;
-
+ SetResourceReference(CurrentPrimaryColorProperty, "WD.PrimaryColor");
+ Loaded += (sender, e) => SynchronizeSelection();
+ }
+
+ private static void OnCurrentPrimaryColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ ((Theme)d).SynchronizeSelection();
+ }
+
+ private void SynchronizeSelection()
+ {
+ var color = (Color)GetValue(CurrentPrimaryColorProperty);
+ ThemeItem selectedItem = null;
+ foreach (var item in ThemeItems)
+ {
+ var brush = item.Background as SolidColorBrush;
+ if (brush != null && brush.Color == color)
+ {
+ selectedItem = item;
+ break;
+ }
+ }
+
+ _synchronizingSelection = true;
+ try
+ {
+ SelectedItem = selectedItem;
+ }
+ finally
+ {
+ _synchronizingSelection = false;
+ }
}
public override void OnApplyTemplate()
{
@@ -68,6 +104,7 @@ protected override DependencyObject GetContainerForItemOverride()
protected override void OnSelectionChanged(SelectionChangedEventArgs e)
{
base.OnSelectionChanged(e);
+ if (_synchronizingSelection) return;
if (SelectedItem == null) return;
var item = SelectedItem as ThemeItem;
if (item == null) return;
diff --git a/src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLine.cs b/src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLine.cs
deleted file mode 100644
index 927703e7..00000000
--- a/src/WPFDevelopers.Samples.Shared/Controls/TimeLine/TimeLine.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Windows;
-using System.Windows.Controls.Primitives;
-
-namespace WPFDevelopers.Samples.Controls
-{
- public class TimeLine : Selector
- {
- static TimeLine()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(TimeLine), new FrameworkPropertyMetadata(typeof(TimeLine)));
- }
- }
-}
\ No newline at end of file
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/AboutWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/AboutWindow.xaml
index 66d97fe3..769d5457 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/AboutWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/AboutWindow.xaml
@@ -14,7 +14,7 @@
TitleBackground="{DynamicResource WD.WindowBorderBrush}"
TitleBarMode="None"
TitleHeight="30"
- WindowStartupLocation="CenterScreen"
+ WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow"
mc:Ignorable="d">
@@ -70,12 +70,19 @@
-
+ VerticalAlignment="Bottom">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ActivityFeedExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/ActivityFeedExample.xaml.cs
new file mode 100644
index 00000000..de7c87cf
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ActivityFeedExample.xaml.cs
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using WPFDevelopers.Samples.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// ActivityFeedExample.xaml 的交互逻辑
+ ///
+ public partial class ActivityFeedExample : UserControl
+ {
+ public ActivityFeedExample()
+ {
+ InitializeComponent();
+ }
+
+ int num = 0;
+ private void AddButton_Click(object sender, RoutedEventArgs e)
+ {
+ num++;
+ switch (num)
+ {
+ case 1:
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = DateTime.Now.ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "我是骗人布010", Head = "我", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
+ break;
+ case 2:
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "风云大陆", Head = "风", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
+ break;
+ case 3:
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "王羲之", Head = "王", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
+ break;
+ case 4:
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "花雨", Head = "花", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
+ break;
+ case 5:
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "纪春庆", Head = "纪", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
+ this.Feed.Items.Add(new ActivityFeedItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
+ break;
+ default:
+ break;
+ }
+ }
+ Color GetRandomColor()
+ {
+ var random = new Random();
+ return Color.FromRgb((byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255));
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
index a893dd8e..6a035d0f 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/BasicControlsExample.xaml
@@ -78,7 +78,7 @@
中文
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/DataGridExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/DataGridExample.xaml
index bb394c0c..5271bdee 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/DataGridExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/DataGridExample.xaml
@@ -13,6 +13,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/GridSplitterExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/GridSplitterExample.xaml.cs
new file mode 100644
index 00000000..146b6500
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/GridSplitterExample.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews.Basics
+{
+ public partial class GridSplitterExample : UserControl
+ {
+ public GridSplitterExample()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListBoxExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListBoxExample.xaml
index c52af3d4..9b6bcd70 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListBoxExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListBoxExample.xaml
@@ -11,6 +11,7 @@
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListViewExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListViewExample.xaml
index e8f39f6d..01c14ee6 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListViewExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ListViewExample.xaml
@@ -11,6 +11,7 @@
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ThemeExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ThemeExample.xaml
index 640780d7..f48ed282 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ThemeExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Basics/ThemeExample.xaml
@@ -89,7 +89,7 @@
中文
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml
similarity index 82%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml
index c5e229da..1ad85a60 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml
@@ -1,5 +1,5 @@
-
-
+
+ WPFASP.NET
@@ -28,11 +28,11 @@
WinFormUWP
-
-
+
+
-
+
@@ -43,7 +43,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center">
-
+
-
-
+
+
+ Haader="BubbleSelection.cs" />
+ Haader="BubbleCanvas.cs" />
+ Haader="BubbleSelection.xaml" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml.cs
similarity index 53%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml.cs
index 9a5432f1..ad1a7d26 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/BubblleControlExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/BubbleSelectionExample.xaml.cs
@@ -6,11 +6,11 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// BubbleControlExample.xaml 的交互逻辑
+ /// BubbleSelectionExample.xaml 的交互逻辑
///
- public partial class BubblleControlExample : UserControl
+ public partial class BubbleSelectionExample : UserControl
{
- public BubblleControlExample()
+ public BubbleSelectionExample()
{
InitializeComponent();
}
@@ -19,9 +19,9 @@ public BubblleControlExample()
WPFDevelopers.Controls.MessageBox.Show("点击完成。");
});
- private void BubblleControl_Click(object sender, System.Windows.RoutedEventArgs e)
+ private void BubbleSelection_Click(object sender, System.Windows.RoutedEventArgs e)
{
- MessageBox.Show($"点击了“ {MyBubblleControl.SelectedText}开发者 ”.", "提示",MessageBoxButton.OK,MessageBoxImage.Information);
+ MessageBox.Show($"点击了“ {MyBubbleSelection.SelectedText}开发者 ”.", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ColorPickerExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/ColorPickerExample.xaml
index ada5c56f..861446d8 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/ColorPickerExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ColorPickerExample.xaml
@@ -11,7 +11,48 @@
d:DesignWidth="800"
mc:Ignorable="d">
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
index c29908fe..293175fd 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/DateRangePickerExample.xaml
@@ -24,7 +24,7 @@
wd:ElementHelper.CornerRadius="3"
EndWatermark="EndDate"
StartWatermark="StartDate" />
-
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml
similarity index 89%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml
index a95a066b..df79221a 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml
@@ -1,5 +1,5 @@
-
-
-
+
+
+ Haader="Flame.xaml" />
+ Haader="Flame.cs" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml.cs
similarity index 56%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml.cs
index 16ba9479..4197fb40 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/FlameExample.xaml.cs
@@ -3,11 +3,11 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// CropControlExample.xaml 的交互逻辑
+ /// Interaction logic for FlameExample.xaml
///
- public partial class CropControlExample : UserControl
+ public partial class FlameExample : UserControl
{
- public CropControlExample()
+ public FlameExample()
{
InitializeComponent();
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml
index a84ccb03..906ddcd2 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/GestureUnlockExample.xaml
@@ -13,14 +13,17 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -28,16 +31,19 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml
new file mode 100644
index 00000000..0c01d99d
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml
@@ -0,0 +1,274 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml.cs
new file mode 100644
index 00000000..842c67f6
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/HomeExample.xaml.cs
@@ -0,0 +1,261 @@
+using System;
+using System.ComponentModel;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Json;
+using System.Threading;
+using System.Windows;
+using System.Windows.Controls;
+using WPFDevelopers.Controls;
+using Tag = WPFDevelopers.Controls.Tag;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ public partial class HomeExample : UserControl
+ {
+ private CancellationTokenSource _statisticsRequest;
+ private bool _statisticsLoaded;
+ private bool _synchronizingTheme;
+
+ public HomeExample()
+ {
+ InitializeComponent();
+ VersionTag.Content = typeof(Tag).Assembly.GetName().Version.ToString(3);
+ Loaded += HomeExample_Loaded;
+ Unloaded += HomeExample_Unloaded;
+ }
+
+ private void HomeExample_Loaded(object sender, RoutedEventArgs e)
+ {
+ WPFDevelopers.Resources.ThemeChanged -= Resources_ThemeChanged;
+ WPFDevelopers.Resources.ThemeChanged += Resources_ThemeChanged;
+ SynchronizeTheme();
+ if (!_statisticsLoaded)
+ RefreshStatistics();
+ }
+
+ private void HomeExample_Unloaded(object sender, RoutedEventArgs e)
+ {
+ WPFDevelopers.Resources.ThemeChanged -= Resources_ThemeChanged;
+ if (_statisticsRequest == null)
+ return;
+
+ _statisticsRequest.Cancel();
+ _statisticsRequest = null;
+ RefreshButton.IsEnabled = true;
+ }
+
+ private void RefreshButton_Click(object sender, RoutedEventArgs e)
+ {
+ RefreshStatistics();
+ }
+
+ private void RefreshStatistics()
+ {
+ if (_statisticsRequest != null)
+ return;
+
+ var request = new CancellationTokenSource();
+ _statisticsRequest = request;
+ RefreshButton.IsEnabled = false;
+ StarsTag.Content = DownloadsTag.Content = "加载中";
+ StatisticsStatus.Text = "正在读取 GitHub Star 和 NuGet 累计下载量...";
+ var worker = new BackgroundWorker();
+ worker.DoWork += (sender, e) =>
+ {
+ var stars = LoadMetric("GitHub", () =>
+ ReadCount(DownloadJson(
+ "https://api.github.com/repos/WPFDevelopersOrg/WPFDevelopers", request.Token).Stars));
+ request.Token.ThrowIfCancellationRequested();
+ var downloads = LoadMetric("NuGet", () =>
+ {
+ var result = DownloadJson(
+ "https://azuresearch-usnc.nuget.org/query?q=packageid:WPFDevelopers&prerelease=true", request.Token);
+ var package = result.Data == null ? null : result.Data.FirstOrDefault(item =>
+ string.Equals(item.Id, "WPFDevelopers", StringComparison.OrdinalIgnoreCase));
+ if (package == null)
+ throw new InvalidDataException("NuGet 未返回 WPFDevelopers 包统计");
+ return ReadCount(package.TotalDownloads);
+ });
+ e.Result = new[] { stars, downloads };
+ };
+ worker.RunWorkerCompleted += (sender, e) =>
+ {
+ var isCurrent = ReferenceEquals(_statisticsRequest, request);
+ request.Dispose();
+ worker.Dispose();
+ if (!isCurrent)
+ return;
+
+ _statisticsRequest = null;
+ RefreshButton.IsEnabled = true;
+ if (e.Error != null)
+ {
+ StarsTag.Content = DownloadsTag.Content = "加载失败";
+ StatisticsStatus.Text = "统计加载失败:" + e.Error.Message + "。请点击“刷新统计”重试。";
+ return;
+ }
+
+ var metrics = (MetricResult[])e.Result;
+ StarsTag.Content = metrics[0].Content;
+ DownloadsTag.Content = metrics[1].Content;
+ var errors = metrics.Where(metric => metric.Error != null).Select(metric => metric.Error).ToArray();
+ _statisticsLoaded = errors.Length == 0;
+ StatisticsStatus.Text = _statisticsLoaded
+ ? "更新于 " + DateTime.Now.ToString("HH:mm:ss") + " · 下载量为 NuGet 所有版本累计下载量"
+ : string.Join(Environment.NewLine, errors);
+ };
+ worker.RunWorkerAsync();
+ }
+
+ private static MetricResult LoadMetric(string source, Func load)
+ {
+ try
+ {
+ return new MetricResult { Content = load().ToString("N0", CultureInfo.InvariantCulture) };
+ }
+ catch (WebException ex)
+ {
+ return MetricFailure(source, ex);
+ }
+ catch (SerializationException ex)
+ {
+ return MetricFailure(source, ex);
+ }
+ catch (InvalidDataException ex)
+ {
+ return MetricFailure(source, ex);
+ }
+ }
+
+ private static MetricResult MetricFailure(string source, Exception error)
+ {
+ return new MetricResult
+ {
+ Content = "加载失败",
+ Error = source + " 统计加载失败:" + error.Message + "。请点击“刷新统计”重试。"
+ };
+ }
+
+ private static T DownloadJson(string address, CancellationToken cancellationToken)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ var request = (HttpWebRequest)WebRequest.Create(address);
+ request.UserAgent = "WPFDevelopers-Demo/1.0";
+ request.Accept = "application/json";
+ request.Timeout = 15000;
+ request.ReadWriteTimeout = 15000;
+ using (cancellationToken.Register(request.Abort))
+ using (var response = request.GetResponse())
+ using (var stream = response.GetResponseStream())
+ {
+ var result = new DataContractJsonSerializer(typeof(T)).ReadObject(stream);
+ if (result == null)
+ throw new InvalidDataException("统计响应为空");
+ return (T)result;
+ }
+ }
+
+ private static long ReadCount(long? count)
+ {
+ if (!count.HasValue || count.Value < 0)
+ throw new InvalidDataException("统计响应缺少有效的计数");
+ return count.Value;
+ }
+
+ private void RepositoryButton_Click(object sender, RoutedEventArgs e)
+ {
+ var button = sender as Button;
+ var address = button == null ? null : button.Tag as string;
+ Uri uri;
+ if (!Uri.TryCreate(address, UriKind.Absolute, out uri) || uri.Scheme != Uri.UriSchemeHttps)
+ throw new InvalidOperationException("Repository button has no valid HTTPS address.");
+
+ try
+ {
+ Process.Start(new ProcessStartInfo(uri.AbsoluteUri) { UseShellExecute = true });
+ LinkError.Visibility = Visibility.Collapsed;
+ }
+ catch (Win32Exception ex)
+ {
+ ShowLinkError(ex);
+ }
+ catch (InvalidOperationException ex)
+ {
+ ShowLinkError(ex);
+ }
+ }
+
+ private void ShowLinkError(Exception error)
+ {
+ LinkError.Text = "无法打开链接:" + error.Message;
+ LinkError.Visibility = Visibility.Visible;
+ }
+
+ private void Segmented_ItemClick(object sender, RoutedEventArgs e)
+ {
+ if (_synchronizingTheme) return;
+ var segmented = sender as Segmented;
+ var theme = segmented.SelectedIndex == 0 ? ThemeType.Light : ThemeType.Dark;
+ if (ThemeManager.Instance.Resources.Theme == theme) return;
+ App.Theme = theme;
+ ThemeManager.Instance.SwitchTheme(PART_Segmented, theme);
+ SynchronizeTheme();
+ }
+
+ private void Resources_ThemeChanged(ThemeType currentTheme)
+ {
+ SynchronizeTheme();
+ }
+
+ private void SynchronizeTheme()
+ {
+ var theme = ThemeManager.Instance.Resources.Theme;
+ _synchronizingTheme = true;
+ try
+ {
+ PART_Segmented.SelectedIndex = theme == ThemeType.Dark ? 1 : 0;
+ SegmentedLight.IsChecked = theme != ThemeType.Dark;
+ SegmentedDark.IsChecked = theme == ThemeType.Dark;
+ }
+ finally
+ {
+ _synchronizingTheme = false;
+ }
+ }
+
+ private sealed class MetricResult
+ {
+ public string Content { get; set; }
+ public string Error { get; set; }
+ }
+
+ [DataContract]
+ private sealed class RepositoryStatistics
+ {
+ [DataMember(Name = "stargazers_count")]
+ public long? Stars { get; set; }
+ }
+
+ [DataContract]
+ private sealed class PackageSearchResult
+ {
+ [DataMember(Name = "data")]
+ public PackageStatistics[] Data { get; set; }
+ }
+
+ [DataContract]
+ private sealed class PackageStatistics
+ {
+ [DataMember(Name = "id")]
+ public string Id { get; set; }
+
+ [DataMember(Name = "totalDownloads")]
+ public long? TotalDownloads { get; set; }
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml
similarity index 67%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml
index b70ccb68..fba9a81d 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/CropControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml
@@ -1,5 +1,5 @@
-
+
-
-
+
+
+ Haader="ImageCrop.xaml" />
+ Haader="ImageCrop.cs" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml.cs
similarity index 56%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml.cs
index 9decfc70..49592109 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ImageCropExample.xaml.cs
@@ -3,11 +3,11 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// RulerControlExample.xaml 的交互逻辑
+ /// ImageCropExample.xaml 的交互逻辑
///
- public partial class RulerControlExample : UserControl
+ public partial class ImageCropExample : UserControl
{
- public RulerControlExample()
+ public ImageCropExample()
{
InitializeComponent();
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
index 808ceea5..5700d4f3 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml
@@ -24,6 +24,31 @@
HorizontalAlignment="Right"
wd:PanelHelper.Spacing="2"
Orientation="Horizontal">
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -188,6 +293,7 @@
@@ -195,7 +301,6 @@
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml.cs
index c5175b3b..af4a8766 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MainWindow.xaml.cs
@@ -7,6 +7,7 @@
using System.Windows.Media;
using System.Windows.Media.Animation;
using WPFDevelopers.Controls;
+using WPFDevelopers.Helpers;
using WPFDevelopers.Samples.ExampleViews;
using WPFDevelopers.Samples.Helpers;
using MessageBox = WPFDevelopers.Controls.MessageBox;
@@ -21,6 +22,7 @@ public partial class MainWindow
public MainWindow()
{
InitializeComponent();
+ VersionText.Text = "v" + typeof(MainWindow).BaseType.Assembly.GetName().Version.ToString(3);
Loaded += OnMainWindow_Loaded;
Closing += MainWindow_Closing;
}
@@ -33,8 +35,13 @@ private void OnMainWindow_Loaded(object sender, RoutedEventArgs e)
private void ThemeSwitchBtn_Click(object sender, RoutedEventArgs e)
{
- var targetTheme = App.Theme == ThemeType.Dark ? ThemeType.Light : ThemeType.Dark;
- ThemeManager.Instance.SwitchTheme(ThemeSwitchBtn, targetTheme);
+ ToggleTheme(ThemeSwitchBtn);
+ }
+
+ public void ToggleTheme(FrameworkElement source)
+ {
+ var targetTheme = ThemeManager.Instance.Resources.Theme == ThemeType.Dark ? ThemeType.Light : ThemeType.Dark;
+ ThemeManager.Instance.SwitchTheme(source, targetTheme);
App.Theme = targetTheme;
SetThemeSource();
ThemeSwitchBtn.IsChecked = targetTheme == ThemeType.Dark;
@@ -56,7 +63,7 @@ private void Quit_Click(object sender, RoutedEventArgs e)
private void About_Click(object sender, RoutedEventArgs e)
{
- new AboutWindow().Show();
+ new AboutWindow().MaskShowDialog();
}
private void SendMessage_Click(object sender, RoutedEventArgs e)
{
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/MaskExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/MaskExample.xaml.cs
index bb0f0113..eca20909 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/MaskExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/MaskExample.xaml.cs
@@ -15,12 +15,12 @@ public MaskExample()
private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
- new AboutWindow().MaskShowDialog();
+ new AboutWindow { Owner = System.Windows.Window.GetWindow(this) }.MaskShowDialog();
}
private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
{
- new AboutWindow().MaskShow();
+ new AboutWindow { Owner = System.Windows.Window.GetWindow(this) }.MaskShow();
}
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml.cs
deleted file mode 100644
index 892c8f94..00000000
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/OtherControlExample.xaml.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace WPFDevelopers.Samples.ExampleViews
-{
- ///
- /// Interaction logic for OtherControlExample.xaml
- ///
- public partial class OtherControlExample : UserControl
- {
- public OtherControlExample()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml
similarity index 75%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml
index d2505115..555c99a8 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml
@@ -1,5 +1,5 @@
-
-
+
-
+ PieSegmentModels="{Binding PieSegmentModels, RelativeSource={RelativeSource AncestorType=local:PieSegmentExample}}" />
+
-
-
+
+
+ Haader="PieSegment.xaml" />
+ Haader="PieSegment.cs" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml.cs
similarity index 91%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml.cs
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml.cs
index 01b5bbba..5edd0dc4 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/PieControlExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/PieSegmentExample.xaml.cs
@@ -7,9 +7,9 @@
namespace WPFDevelopers.Samples.ExampleViews
{
///
- /// PieControlExample.xaml 的交互逻辑
+ /// PieSegmentExample.xaml 的交互逻辑
///
- public partial class PieControlExample : UserControl
+ public partial class PieSegmentExample : UserControl
{
public ObservableCollection PieSegmentModels
{
@@ -18,10 +18,10 @@ public ObservableCollection PieSegmentModels
}
public static readonly DependencyProperty PieSegmentModelsProperty =
- DependencyProperty.Register("PieSegmentModels", typeof(ObservableCollection), typeof(PieControlExample), new PropertyMetadata(null));
+ DependencyProperty.Register("PieSegmentModels", typeof(ObservableCollection), typeof(PieSegmentExample), new PropertyMetadata(null));
List> collectionList = new List>();
- public PieControlExample()
+ public PieSegmentExample()
{
InitializeComponent();
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml
similarity index 94%
rename from src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
rename to src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml
index 7deb39e9..88fd2322 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerControlExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml
@@ -1,5 +1,5 @@
-
-
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml.cs
new file mode 100644
index 00000000..b785f122
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/RulerExample.xaml.cs
@@ -0,0 +1,15 @@
+using System.Windows.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ ///
+ /// RulerExample.xaml 的交互逻辑
+ ///
+ public partial class RulerExample : UserControl
+ {
+ public RulerExample()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml
new file mode 100644
index 00000000..36985c67
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml.cs
new file mode 100644
index 00000000..c0796688
--- /dev/null
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollNavigationExample.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows.Controls;
+
+namespace WPFDevelopers.Samples.ExampleViews
+{
+ public partial class ScrollNavigationExample : UserControl
+ {
+ public ScrollNavigationExample()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml
index 391c2f19..eebc697a 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/ScrollViewerAnimationExample.xaml
@@ -15,7 +15,10 @@
-
+
@@ -46,7 +49,8 @@
+ IsScrollAnimation="True"
+ wd:ScrollViewerBehavior.IsBackToTopEnabled="True">
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml
index 3b77df6f..c67c0327 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/SpacingExample.xaml
@@ -26,10 +26,17 @@
Height="40"
Padding="20,0"
Header="WrapPanel">
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml
index e7c5f0e7..3a3123b9 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml
@@ -1,44 +1,182 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+ Haader="TimelineExampleVM.cs" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml.cs
index df8b4fbc..9578df27 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimeLineExample.xaml.cs
@@ -1,68 +1,100 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using System;
+using System.Collections.ObjectModel;
using System.Windows;
using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-using WPFDevelopers.Samples.Controls;
+using WPFDevelopers.Controls;
+using WPFDevelopers.Samples.ViewModels;
namespace WPFDevelopers.Samples.ExampleViews
{
- ///
- /// TimeLineExample.xaml 的交互逻辑
- ///
- public partial class TimeLineExample : UserControl
+ public partial class TimelineExample : UserControl
{
- public TimeLineExample()
+ private int _eventNumber;
+
+ public ObservableCollection CodeEvents { get; private set; }
+ public Array Orientations { get; private set; }
+ public Array Modes { get; private set; }
+
+ public TimelineExample()
{
+ CodeEvents = new ObservableCollection();
+ Orientations = Enum.GetValues(typeof(Orientation));
+ Modes = Enum.GetValues(typeof(TimelineMode));
+ ResetEvents();
InitializeComponent();
}
- int num = 0;
- private void AddButton_Click(object sender, RoutedEventArgs e)
+ private void Add_Click(object sender, RoutedEventArgs e)
{
- num++;
- switch (num)
+ AddEvent();
+ }
+
+ private void Next_Click(object sender, RoutedEventArgs e)
+ {
+ CompleteEvents(false);
+ AddEvent(true);
+ }
+
+ private void AddEvent(bool isLoading = false)
+ {
+ CodeEvents.Add(new TimelineEvent
{
- case 1:
- this.TimeLine.Items.Add(new TimeLineItem() { Text = DateTime.Now.ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "我是骗人布010", Head = "我", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
- break;
- case 2:
- this.TimeLine.Items.Add(new TimeLineItem() { Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "风云大陆", Head = "风", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
- break;
- case 3:
- this.TimeLine.Items.Add(new TimeLineItem() { Text = DateTime.Now.AddDays(-2).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "王羲之", Head = "王", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
- break;
- case 4:
- this.TimeLine.Items.Add(new TimeLineItem() { Text = DateTime.Now.AddDays(-3).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "花雨", Head = "花", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
- break;
- case 5:
- this.TimeLine.Items.Add(new TimeLineItem() { Text = DateTime.Now.AddDays(-6).ToString("yyyy-MM-dd"), ItemType = ItemTypeEnum.Time });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "纪春庆", Head = "纪", ItemType = ItemTypeEnum.Name, BackgroundColor = new SolidColorBrush(GetRandomColor()) });
- this.TimeLine.Items.Add(new TimeLineItem() { Text = "闫驚鏵/WPFDevelopers", ItemType = ItemTypeEnum.Star });
- break;
- default:
- break;
+ Time = DateTime.Now.ToString("HH:mm:ss"),
+ Title = "Event " + ++_eventNumber,
+ Description = "Added by a C# click event.",
+ Brush = Brushes.DodgerBlue,
+ IsLoading = isLoading
+ });
+ }
+
+ private void Remove_Click(object sender, RoutedEventArgs e)
+ {
+ if (CodeEvents.Count > 0) CodeEvents.RemoveAt(CodeEvents.Count - 1);
+ }
+
+ private void Complete_Click(object sender, RoutedEventArgs e)
+ {
+ CompleteEvents(true);
+ }
+
+ private void CompleteEvents(bool onlyLoading)
+ {
+ foreach (var item in CodeEvents)
+ {
+ if (onlyLoading && !item.IsLoading) continue;
+ item.IsLoading = false;
+ item.Title = "Completed";
+ item.Description = "Updated by a C# click event.";
+ item.Brush = Brushes.SeaGreen;
}
}
- Color GetRandomColor()
+
+ private void Reset_Click(object sender, RoutedEventArgs e)
+ {
+ ResetEvents();
+ }
+
+ private void ResetEvents()
{
- var random = new Random();
- return Color.FromRgb((byte)random.Next(0, 255), (byte)random.Next(0, 255), (byte)random.Next(0, 255));
+ CodeEvents.Clear();
+ _eventNumber = 3;
+ CodeEvents.Add(new TimelineEvent
+ {
+ Time = "09:00", Title = "Created",
+ Description = "Create a service site.", Brush = Brushes.DodgerBlue
+ });
+ CodeEvents.Add(new TimelineEvent
+ {
+ Time = "10:00", Title = "Completed",
+ Description = "Solve initial network problems.", Brush = Brushes.SeaGreen
+ });
+ CodeEvents.Add(new TimelineEvent
+ {
+ Time = "11:00", Title = "In progress",
+ Description = "Technical testing is in progress.", Brush = Brushes.DodgerBlue,
+ IsLoading = true
+ });
}
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimePickerExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimePickerExample.xaml
index 8a26e557..185c14ee 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/TimePickerExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/TimePickerExample.xaml
@@ -24,12 +24,20 @@
Width="200"
VerticalAlignment="Center"
wd:ElementHelper.Watermark="selection time"
- SelectedTime="2023-05-06 23:59:59" />
+ SelectedTime="2023-05-06 23:59:59"
+ SelectedTimeFormat="HH:mm" />
+
+ SelectedTime="{Binding MyDateTime, RelativeSource={RelativeSource AncestorType=local:TimePickerExample}}"
+ SelectedTimeFormat="hh:mm tt" />
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml
index 99452bc9..1e4d5402 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/VirtualizingWrapPanelExample.xaml
@@ -1,119 +1,156 @@
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
-
+
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml
index 2989454b..46cdef80 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml
@@ -4,144 +4,95 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:WPFDevelopers.Samples.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
- xmlns:local="clr-namespace:WPFDevelopers.Samples.ExampleViews"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:vm="clr-namespace:WPFDevelopers.Samples.ViewModels"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml.cs b/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml.cs
index c649bcfb..3850b4e1 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml.cs
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/WaterfallPanelExample.xaml.cs
@@ -1,4 +1,6 @@
-using System.Windows.Controls;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Controls;
namespace WPFDevelopers.Samples.ExampleViews
{
@@ -7,9 +9,22 @@ namespace WPFDevelopers.Samples.ExampleViews
///
public partial class WaterfallPanelExample : UserControl
{
+ private bool _imageFailureReported;
+
public WaterfallPanelExample()
{
InitializeComponent();
}
+
+ private void Image_Failed(object sender, ExceptionRoutedEventArgs e)
+ {
+ Debug.WriteLine("[Waterfall] Image failed: " + e.ErrorException);
+ if (_imageFailureReported)
+ return;
+
+ _imageFailureReported = true;
+ WPFDevelopers.Controls.MessageBox.Show(e.ErrorException.ToString(),
+ "Waterfall image loading failed");
+ }
}
}
diff --git a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
index a21a5076..9dc82f30 100644
--- a/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
+++ b/src/WPFDevelopers.Samples.Shared/ExampleViews/Window/WindowExample.xaml
@@ -20,13 +20,11 @@
Rows="2">
@@ -61,10 +71,20 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/WPFDevelopers.Shared/Themes/Basic/Dark.Color.xaml b/src/WPFDevelopers.Shared/Themes/Basic/Dark.Color.xaml
index 08e4d3e5..0ab5ae52 100644
--- a/src/WPFDevelopers.Shared/Themes/Basic/Dark.Color.xaml
+++ b/src/WPFDevelopers.Shared/Themes/Basic/Dark.Color.xaml
@@ -21,6 +21,17 @@
po:Freeze="True"
Color="{StaticResource WD.RegularTextColor}" />
+ #606266
+
+ #909399
+
+
#323232
-
-
M384 690l452-452 60 60-512 512-238-238 60-60zM 998 352 C 998 344 994 335 988 329 L 938 279 C 932 273 924 269 915 269 C 907 269 898 273 892 279 L 499 672 L 106 279 C 100 273 91 269 83 269 C 75 269 66 273 60 279 L 10 329 C 4 335 0 344 0 352 C 0 360 4 369 10 375 L 476 841 C 482 847 491 851 499 851 C 507 851 516 847 522 841 L 988 375 C 994 369 998 360 998 352 Z
@@ -86,4 +84,9 @@
M13 2h-1v1.5c0 .28-.22.5-.5.5h-2c-.28 0-.5-.22-.5-.5V2H6v1.5c0 .28-.22.5-.5.5h-2c-.28 0-.5-.22-.5-.5V2H2c-.55 0-1 .45-1 1v11c0 .55.45 1 1 1h11c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 12H2V5h11v9zM5 3H4V1h1v2zm6 0h-1V1h1v2zM6 7H5V6h1v1zm2 0H7V6h1v1zm2 0H9V6h1v1zm2 0h-1V6h1v1zM4 9H3V8h1v1zm2 0H5V8h1v1zm2 0H7V8h1v1zm2 0H9V8h1v1zm2 0h-1V8h1v1zm-8 2H3v-1h1v1zm2 0H5v-1h1v1zm2 0H7v-1h1v1zm2 0H9v-1h1v1zm2 0h-1v-1h1v1zm-8 2H3v-1h1v1zm2 0H5v-1h1v1zm2 0H7v-1h1v1zm2 0H9v-1h1v1zM20 109.9988C20 93.43 33.4314 79.998 50 79.998H80L80 99.998H50C44.4772 99.998 40 104.476 40 109.9988L40 249.9988C40 255.5216 44.4772 259.9988 50 259.9988L190 259.9988C195.5228 259.9988 200 255.5216 200 249.9988V219.9996H110C93.4316 219.9996 80 206.5682 80 189.9996V50C80 33.432 93.4316 20 110 20H250C266.568 20 280 33.432 280 50V189.9996C280 206.5682 266.568 219.9996 250 219.9996H220V249.9988C220 266.5674 206.568 279.9988 190 279.9988H50C33.4314 279.9988 20 266.5674 20 249.9988V109.9988zM100 189.9996C100 195.5224 104.4772 199.9996 110 199.9996H250C255.522 199.9996 260 195.5224 260 189.9996V50C260 44.476 255.522 40 250 40H110C104.4772 40 100 44.476 100 50V189.9996zM0,0 L10,0 L6,5 L6,10 L4,10 L4,5 L0,0
+ M396 712 L233 512 L178 580 L396 848 L861 272 L807 204 Z
+ M 1,7 A 6,6 0 0 0 13,7
+ M854,346 512,0 170,346 232,404 470,166 470,684 554,684 554,166 794,404z
+ M170,678 512,1024 854,678 792,620 554,858 554,340 470,340 470,858 232,620z
+ M1.5,0 A1.5,1.5 0 1 1 1.5,3 A1.5,1.5 0 1 1 1.5,0 Z M1.5,6 A1.5,1.5 0 1 1 1.5,9 A1.5,1.5 0 1 1 1.5,6 Z M1.5,12 A1.5,1.5 0 1 1 1.5,15 A1.5,1.5 0 1 1 1.5,12 Z
diff --git a/src/WPFDevelopers.Shared/Themes/Basic/Light.Color.xaml b/src/WPFDevelopers.Shared/Themes/Basic/Light.Color.xaml
index 90ff9007..812b981c 100644
--- a/src/WPFDevelopers.Shared/Themes/Basic/Light.Color.xaml
+++ b/src/WPFDevelopers.Shared/Themes/Basic/Light.Color.xaml
@@ -16,6 +16,18 @@
x:Key="WD.RegularTextBrush"
po:Freeze="True"
Color="{StaticResource WD.RegularTextColor}" />
+
+ #C0C4CC
+
+ #909399
+
+
#FFFFFF
-
+ VerticalAlignment="Top"
+ SelectedItem="{Binding ColorType, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml b/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
index 7eae1c94..143a03b3 100644
--- a/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
+++ b/src/WPFDevelopers.Shared/Themes/DateRangePicker.xaml
@@ -7,6 +7,28 @@
+
+ Style="{StaticResource WD.DateRangePickerTextBox}" />
+ Style="{StaticResource WD.DateRangePickerTextBox}" />