Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Windows Presentation Foundation
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Windows Presentation Foundation Discussion of the beta version of Windows Presentation Foundation "WPF" formerly know as codename "Avalon" as well as the related XAML.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Windows Presentation Foundation section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 17th, 2008, 10:26 AM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Binding ComboBox inside ListView problem

I am attempting to put a bound ComboBox into my ListView. However, I can not get it to bind correctly. All of the textboxes that are in the ListView bind without any issues, but the ComboBox has issues. I am binding to the DefaultView of a DataTable in the code-behind. I have verified that the field that I am trying to bind to exists, as I tested by putting a TextBox in place of the ComboBox when I initially created the ListView. Thanks in advance for any tips.

-----
The following line of code is what does the binding.
-----

child.ItemsSource = customBusinessProcessTables.Tables["process_rule_input_val"].DefaultView;

----
The following is the listview that I am attempting to bind to.
----

<ListView Margin ="0,20,0,0" x:Name="_processruleinputvalList" HorizontalAlignment="Left" Width="Auto" Height="120">
                                        <ListView.View>
                                          <GridView>
                                            <GridViewColumn Header="Name" Width="300">
                                              <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                  <Label Content="{Binding Path=table_and_field}" VerticalContentAlignment="Center"></Label>
                                                </DataTemplate>
                                              </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="Operator" Width="55">
                                              <GridViewColumn.CellTemplate>
                                                <DataTemplate>

                                                  <ComboBox Name="mycombo" SelectedItem="{Binding Path=operator, Mode=TwoWay}" Width = "50">
                                                    <ComboBoxItem Content=""></ComboBoxItem>
                                                    <ComboBoxItem>EQ</ComboBoxItem>
                                                    <ComboBoxItem>NE</ComboBoxItem>
                                                    <ComboBoxItem>CH</ComboBoxItem>
                                                    <ComboBoxItem>GE</ComboBoxItem>
                                                    <ComboBoxItem>LE</ComboBoxItem>
                                                  </ComboBox>
                                                </DataTemplate>
                                              </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="Value" Width="300">
                                              <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                  <TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "300" Text="{Binding Path=value}" VerticalContentAlignment="Center">
                                                  </TextBox>
                                                </DataTemplate>
                                              </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="Created By" Width="100">
                                              <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                  <TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "100" Text="{Binding Path=created_by}" VerticalContentAlignment="Center">
                                                  </TextBox>
                                                </DataTemplate>
                                              </GridViewColumn.CellTemplate>
                                            </GridViewColumn>
                                            <GridViewColumn Header="Created Date" Width="100">
                                              <GridViewColumn.CellTemplate>
                                                <DataTemplate>
                                                  <TextBox Name="tbListLabelValue" IsReadOnly="False" TextWrapping="WrapWithOverflow" Width = "100" Text="{Binding Path=created_dttm}" VerticalContentAlignment="Center">
                                                  </TextBox>
                                                </DataTemplate>
                                              </GridViewColumn.CellTemplate>
                                            </GridViewColumn>

                                          </GridView>
                                        </ListView.View>
                                      </ListView>

Reply With Quote
  #2 (permalink)  
Old July 17th, 2008, 02:13 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Solution is here:

http://forums.msdn.microsoft.com/en-...-bf10fe846add/

Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate ListView From ComboBox Select eusanpe C# 4 August 20th, 2007 06:49 PM
CheckBox binding in ListView - Multiple events! dweezilb Windows Presentation Foundation 1 April 22nd, 2007 06:39 PM
Binding a comboBox to update a listView Amethyst1984 VB How-To 2 February 28th, 2006 02:07 PM
Issue Binding to ComboBox. lam_lvl VB.NET 2002/2003 Basics 1 February 22nd, 2006 08:38 PM
Embed ListView in Combobox (Urgent) HemaChaudhry VB.NET 0 January 2nd, 2006 08:17 AM



All times are GMT -4. The time now is 11:49 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.