Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/keyboarddrummer/wpfbindingsfromexpressions
Generates WPF bindings from C# Expression trees.
https://github.com/keyboarddrummer/wpfbindingsfromexpressions
Last synced: 23 days ago
JSON representation
Generates WPF bindings from C# Expression trees.
- Host: GitHub
- URL: https://github.com/keyboarddrummer/wpfbindingsfromexpressions
- Owner: keyboardDrummer
- Created: 2015-01-23T09:06:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-06T08:29:23.000Z (over 7 years ago)
- Last Synced: 2024-04-13T16:04:55.935Z (7 months ago)
- Language: C#
- Homepage:
- Size: 99.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WPFBindingsFromExpressions
Allows you to write WPF bindings using C# expression trees.Both OneWay and TwoWay bindings can be generated, depending on what's possible given the original expression tree:
ExpressionToBindingParser.TwoWay(() => Child.InputText).Apply(TextBox, TextBox.TextProperty);
ExpressionToBindingParser.OneWay(() => "You wrote: " + Child.InputText).Apply(Label, ContentProperty);By using an expression tree that takes an argument, bindings that use a context value are created:
var isCheckedColumn = new DataGridCheckBoxColumn();
isCheckedColumn.Binding = ExpressionToBindingParser.OneWay((Item item) =>
item.ChildItem.IsChecked && item.IsChecked).ToBindingBase();
##### Details
The expression tree is parsed by the framework and converted into a WPF BindingBase.
From the expression tree, as much as possible is converted into WPF paths,
while the remaining part of the expression tree is moved into a WPF value converter.
By putting the expression tree into WPF paths,
WPF will track these paths using INotifyPropertyChange and update the bound controls when required.