localzuk Posted March 19, 2015 Posted March 19, 2015 I have a form with a combobox at the top. The combobox is bound to a list of objects, each containing a bunch of properties. The rest of the form contains various input fields (text, RGB, etc...) which relate to those properties. In winforms, I'd just populate it manually via the relevant event. However, WPF has its binding way of doing things, which I'm still getting my head around - and I'm thinking that there is probably a way of linking the whole lot up with binding to the same objects. Anyone know if I can do it that way?
localzuk Posted March 19, 2015 Author Posted March 19, 2015 Well, figured it out, with the help of this book - Pro C# 5.0 and the .NET 4.5 Framework (Expert's Voice in .NET): Amazon.co.uk: Andrew Troelsen: 9781430242338: Books Basically, set the DataContext to the SelectedItem of the ComboBox, then set the Content attribute to be {Binding Path=PropertyName}. Simples.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now