Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dwndland/chapter.net.wpf.behaviors
Brings additional behaviors to existing WPF controls.
https://github.com/dwndland/chapter.net.wpf.behaviors
behaviors csharp extensions features wpf
Last synced: 25 days ago
JSON representation
Brings additional behaviors to existing WPF controls.
- Host: GitHub
- URL: https://github.com/dwndland/chapter.net.wpf.behaviors
- Owner: dwndland
- License: mit
- Created: 2024-12-01T18:31:53.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-12-01T18:32:52.000Z (2 months ago)
- Last Synced: 2025-01-01T19:46:20.511Z (about 1 month ago)
- Topics: behaviors, csharp, extensions, features, wpf
- Language: C#
- Homepage:
- Size: 72.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Chapter.Net.WPF.Behaviors Library
## Overview
Brings additional behaviors to existing WPF controls.## Features
- **ColumnSortBehavior:** Enables sorting by click on the header on a ListView.
- **ColumnVisibilityBehavior:** Enables dynamically display and hide of columns of a ListView.
- **ColumnWidthBehavior:** Allows defining column sizes of a ListView.
- **ComboBoxBehavior:** Brings the definition of max text length of the combobox if it is editable.
- **CutTooltipBehavior:** Brings the functionality to the TextBlock and Label to show the text in the tooltip automatically when its cut.
- **DoubleClickBehavior:** Brings the feature to be able to double click any UI element.
- **DragMoveBehavior:** Enables that a window can be moved by the mouse when drop down on a content.
- **DynamicResourceBehavior:** Brings the possibility to create a dynamic resource out of a binding value.
- **FocusBehavior:** Brings the feature to set the focus to a specific element or on window launch.
- **FrameworkBehavior:** Brings commands for actions on FrameworkElements.
- **KeyBlockBehavior:** Disabled specific keys on a control.
- **ListBehavior:** Gives you some commands when clicking in an ItemsControl or its items.
- **ScrollBehavior:** Brings the feature to modify the scroll position of an items control.
- **TextBoxBehavior:** Brings the features to text boxes to define its selection or bound the selection part.
- **WindowBehavior:** Brings the feature to a Window to bind loading and closing action or easy close with dialog result.
- **WindowTitleBarBehavior:** Brings the feature to the Window to disable or hide elements in the title bar.## Getting Started
1. **Installation:**
- Install the Chapter.Net.WPF.Behaviors library via NuGet Package Manager:
```bash
dotnet add package Chapter.Net.WPF.Behaviors
```2. **ColumnSortBehavior:**
- Usage
```xaml
```3. **ColumnVisibilityBehavior:**
- Usage
```csharp
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
VisibleColumnNames = new EnhancedObservableCollection { "Name", "Size" };
}public EnhancedObservableCollection VisibleColumnNames { get; private set; }
}
```
```xaml
```4. **ColumnWidthBehavior:**
- Usage
```xaml
```5. **ComboBoxBehavior:**
- Usage
```xaml
```6. **CutTooltipBehavior:**
- Usage
```xaml
```7. **DoubleClickBehavior:**
- Usage
```xaml
```8. **DragMoveBehavior:**
- Usage
```xaml
```9. **DynamicResourceBehavior:**
- Usage
```xaml
```10. **FocusBehavior:**
- Usage
```xaml
```11. **FrameworkBehavior:**
- Usage
```xaml
```
```csharp
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
ButtonLoadedCommand = new DelegateCommand(ButtonLoaded);
}
public DelegateCommand ButtonLoadedCommand { get; private set; }
private void ButtonLoaded()
{
}
}
```12. **KeyBlockBehavior:**
- Usage
```xaml
```13. **ListBehavior:**
- Usage
```xaml
```14. **ScrollBehavior:**
- Usage
```xaml
```15. **TextBoxBehavior:**
- Usage
```xaml
```16. **WindowBehavior:**
- Usage
```xaml
```
```csharp
public class MainViewModel : ObservableObject
{
public MainViewModel()
{
TryCloseCommand = new DelegateCommand(TryClose);
}
public DelegateCommand TryCloseCommand { get; private set; }
private void TryClose(WindowClosingArgs e)
{
// Ask user if really close
e.Cancel = true;
//e.DialogResult = false;
}
}
```17. **WindowTitleBarBehavior:**
- Usage
```xaml
```## Links
* [NuGet](https://www.nuget.org/packages/Chapter.Net.WPF.Behaviors)
* [GitHub](https://github.com/dwndland/Chapter.Net.WPF.Behaviors)## License
Copyright (c) David Wendland. All rights reserved.
Licensed under the MIT License. See LICENSE file in the project root for full license information.