VB Listview help (WPF)

Soldato
Joined
27 Sep 2004
Posts
11,202
Location
The Ledge Beyond The Edge
I have a Visual Basic 2008 WPF form and in it i have a list view. WIthin the list view i have text boxes so i can add items to it (in a master detail type set up).
How can i set the value of the text boxes automatically? Normally i would just have txtBox.text = Blah. But i can't do that for text boxes within the list view.

Helpppppp
 
Cool, i will have a look into databinding. Is it the same as binding paths etc which is what i am using already.
Excuse the n00b questions, but will that work with all my data coming from LINQ?
Oh i am wanting it to map to a system item such as tme. Will that matter?
 
Last edited:
This is what i currently have in my xaml
Code:
<GridViewColumn Header="Updated Date/Time" Width="125">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Path=UpdatedDateTime}" 
                                         />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
 
Thanks for you help mate :)

I'll look into INotifyPropertyChanged to do it, because all i can see just now would change my current binding path to the date, and if i do that, it wont write it to anywhere on the DB. Can i do both on the binding path?
 
What it is, is when i want to add a detail record on a master detail form, i want it to automatically populate the date field with the current date. In the master part of the form i would just do a txt.text=Now but i can't seem to name the text field in the listview (which does the detail lines)

I now have the code blow, but it doesn't do anything lol and i have this at the top of my XAML form
xmlns:sys="clr-namespace:System;assembly=mscorlib"

Code:
<GridViewColumn Header="Updated Date/Time" Width="125">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding Source={x:Static sys:DateTime.Now}, Path=UpdatedDateTime}" x:Name="txtJohn"/>
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
 
Sorry i must be being really thick lol I am using VB.

But even when i set the
<TextBox Text="{Binding Source={x:Static sys:DateTime.Now}, Path=UpdatedDateTime}" x:Name="txtJohn"/>


It isn't putting in the date when i try to add a new line :(
 
Back
Top Bottom