![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | Binding a ComboBox to in internal property I haven't done much WPF since last September/October & am trying to bind a combobox on my window to a property in the window itself. Basically, I want to have the equivalent of a NavigationWindow (or IE7's) history next to the back/forward buttons that are based on a journal (due to sizing issues, I can't use NavigationWindow). I've been doing a lot of ASP.Net lately, so I'm aiming for the equivalent of: <asp ropDownList runat="server" DataSource="<%# GetItems() %>"/>protected IEnumerable GetItems() { return new String[] {"one", "two", "three"}; } However, I've tried using ElementName (referencing the root window) and Path (referencing the property) with no luck, and I haven't seen any samples that do this. It's a pretty rudimentary task, but I'm having some issues moving out of the ASP.Net mindset (which leads me to yet again chime in that I hope those two markup models begin to unify) |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Binding a ComboBox to in internal property What you have described should work. In principle it's the same as this example. <Grid Name="Grid" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> <TextBlock Text="{Binding ElementName=Grid, Path=ActualWidth}" /> </Grid> Assuming you defined a property rather a method, and marked it as public not protected. - Doug "Keith Patrick" <richard_keith_patrick@nospam.hotmail.com> wrote in message news:eY1yZ1z5GHA.3436@TK2MSFTNGP03.phx.gbl... >I haven't done much WPF since last September/October & am trying to bind a >combobox on my window to a property in the window itself. Basically, I >want to have the equivalent of a NavigationWindow (or IE7's) history next >to the back/forward buttons that are based on a journal (due to sizing >issues, I can't use NavigationWindow). I've been doing a lot of ASP.Net >lately, so I'm aiming for the equivalent of: > > <asp ropDownList runat="server" DataSource="<%# GetItems() %>"/>> protected IEnumerable GetItems() { > return new String[] {"one", "two", "three"}; > } > > However, I've tried using ElementName (referencing the root window) and > Path (referencing the property) with no luck, and I haven't seen any > samples that do this. It's a pretty rudimentary task, but I'm having some > issues moving out of the ASP.Net mindset (which leads me to yet again > chime in that I hope those two markup models begin to unify) > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Binding a ComboBox to in internal property Ahhh, my problem was that I marked the property as protected (ASP.Net allows for protected binding, and WPF won't throw an exception - which is surprising to me) instead of public Thanks! |
My System Specs![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| binding to combobox itemssource? | .NET General | |||