ElementName=slider, Path=Value}" HorizontalAlignment="Left" Margin="10,32,0,0" VerticalAlignment="Top" Height="40" Width="497"/> Binding to a Property of an Element
Binding binding = new Binding();
binding.Source = slider; binding.Path = new PropertyPath("Value"); binding.Mode = BindingMode.TwoWay; label3.SetBinding(TextBlock.FontSizeProperty, binding); WPF Binding Mode • Default. Varies for each dependancy property • OneTime. Updates the binding target when the application starts or when the data context changes. • OneWay. Updates the binding target (target) property when the binding source (source) changes. • OneWayToSource. Updates the source property when the target property changes. • TwoWay. Causes changes to either the source property or the target property to automatically update the other. Consuming Web Service JSON is… • A lightweight text based data-interchange format • Completely language independent • Based on subset of the JavaScript Programming Language • Easy to understand, manipulate, and generate JSON is not… • A “document” format • A markup language • A programming language JSON Basics • Unordered sets of name/value pairs • Begins with { (left brace) and ends with } (right brace) • Each name is followed by : (colon) • Name/value pairs are separated by , (comma) • Arrays begin with [ (left bracket) and ends with ] (right bracket) • Name/value of each indexes are separated by , (comma) JSON Example var employeeData = { “employee_id”: 123, “name”: “Budi”, “address”: { “street”: “Jl veteran 37”, “city”: “Malang”, “postal_code”: 65146 }, “active”: true }; Sources • www.slideshare.net/jfox015/json-22195683 • http://www.slideshare.net/rmaclean/json-and-rest Tools • NuGet • Restsharp • JSON2CSharp