Click here to Skip to main content
15,887,214 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: ObservableCollection Changed Pin
Pete O'Hanlon10-Mar-10 4:14
mvePete O'Hanlon10-Mar-10 4:14 
GeneralMessage Removed Pin
11-Mar-10 3:05
professionalN_tro_P11-Mar-10 3:05 
GeneralMessage Removed Pin
11-Mar-10 3:15
professionalN_tro_P11-Mar-10 3:15 
QuestionCreating new Silverlight project silently crashes Visual Web Developer 2008 Pin
Kevin McFarlane10-Mar-10 3:04
Kevin McFarlane10-Mar-10 3:04 
AnswerRe: Creating new Silverlight project silently crashes Visual Web Developer 2008 Pin
carlecomm17-Mar-10 15:22
carlecomm17-Mar-10 15:22 
GeneralRe: Creating new Silverlight project silently crashes Visual Web Developer 2008 Pin
Fred Kling21-Mar-10 8:07
Fred Kling21-Mar-10 8:07 
Questionis it possible? Pin
Joe Rozario10-Mar-10 1:05
Joe Rozario10-Mar-10 1:05 
QuestionBinding a Text Box to Data Context Pin
StyleGuide10-Mar-10 0:06
StyleGuide10-Mar-10 0:06 
Hi there,

I'm new to WPF, so bear with me..

I have a Main View, and a view within it. I set the DataContext in my 'OnStartup' C# method:

Views.MainView view = new Views.MainView();
view.AssignmentView.DataContext = new ViewModels.MainViewModel(_assignmentDataSource);


I have previous / next button in my 'AssignmentView', that are linked to commands. This Moves focus from record to record as expected in my ListView, in my XAML :


<ListView Margin="10" ItemsSource="{Binding Assignments}" Grid.Row="0" BorderThickness="1" Background="{x:Null}" Foreground="Black">
<ListView.View>
<GridView>
<GridViewColumn Header="Assignment Name" DisplayMemberBinding="{Binding AssignmentName}>
</GridView>
</ListView.View>
</ListView>

Great.

However, when I use the following Stack Panel, the TextBox data does not change when I press previous / next. It stays on the first record.

<StackPanel Grid.Row="1" Orientation="Vertical" DataContext="{Binding Assignments, Mode=TwoWay}"/>
<StackPanel Orientation="Horizontal"/>
<Label Content="Assignment Name:" Margin="0,0,4,0"/>
<TextBox Width="158" Text="{Binding Path=AssignmentName}"/>
</StackPanel>
</StackPanel>

I think its a problem with the 'DataContext' - I don't think I should be wiring it up in the Stack Panel, but when I remove it, there is no data in the Stack Panel text box..

Where am I going wrong?

Any help greatly appreciated. Thanks.

Jon








bgfbgf
QuestionTextBolck move using up & down arrow?? Pin
urooj_mahmood9-Mar-10 19:51
urooj_mahmood9-Mar-10 19:51 
AnswerRe: TextBolck move using up & down arrow?? Pin
Abhinav S14-Mar-10 21:05
Abhinav S14-Mar-10 21:05 
GeneralRe: TextBolck move using up & down arrow?? Pin
urooj_mahmood16-Mar-10 2:44
urooj_mahmood16-Mar-10 2:44 
GeneralRe: TextBolck move using up & down arrow?? Pin
Abhinav S16-Mar-10 3:52
Abhinav S16-Mar-10 3:52 
GeneralRe: TextBolck move using up & down arrow?? Pin
urooj_mahmood16-Mar-10 6:35
urooj_mahmood16-Mar-10 6:35 
GeneralRe: TextBolck move using up & down arrow?? Pin
Abhinav S16-Mar-10 21:15
Abhinav S16-Mar-10 21:15 
GeneralRe: TextBolck move using up & down arrow?? Pin
urooj_mahmood16-Mar-10 21:52
urooj_mahmood16-Mar-10 21:52 
AnswerRe: TextBolck move using up & down arrow?? Pin
Abhinav S16-Mar-10 22:57
Abhinav S16-Mar-10 22:57 
GeneralRe: TextBolck move using up & down arrow?? Pin
urooj_mahmood17-Mar-10 3:37
urooj_mahmood17-Mar-10 3:37 
GeneralRe: TextBolck move using up & down arrow?? Pin
urooj_mahmood30-Mar-10 2:31
urooj_mahmood30-Mar-10 2:31 
Questionhow can I add mutiple layers on SilverLight User Control?? Pin
urooj_mahmood9-Mar-10 19:50
urooj_mahmood9-Mar-10 19:50 
AnswerRe: how can I add mutiple layers on SilverLight User Control?? Pin
Abhinav S14-Mar-10 20:10
Abhinav S14-Mar-10 20:10 
QuestionSome good WPF books? Pin
Dan Mos9-Mar-10 12:15
Dan Mos9-Mar-10 12:15 
AnswerRe: Some good WPF books? Pin
carlecomm9-Mar-10 18:13
carlecomm9-Mar-10 18:13 
GeneralRe: Some good WPF books? Pin
Dan Mos10-Mar-10 5:19
Dan Mos10-Mar-10 5:19 
AnswerRe: Some good WPF books? Pin
Richard MacCutchan9-Mar-10 21:40
mveRichard MacCutchan9-Mar-10 21:40 
QuestionWPF mapping with Dependency properties Pin
Juan Pablo G.C.9-Mar-10 1:05
Juan Pablo G.C.9-Mar-10 1:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.