Monday 15 March 2010

c# - How to set DataContext in a Dialog Window to its parent's DataContext -



c# - How to set DataContext in a Dialog Window to its parent's DataContext -

i created new window phone call using next code:

nieuwsimulatie niewsimulatiewindow = new nieuwsimulatie() { owner = }; bool? simulatieaangemaakt = niewsimulatiewindow.showdialog();

in window "nieuwsimulatie" i'd have same datacontext in mainwindow, or databind controls straight datacontext using relativesource geuss, ive tried:

<controls:splitbutton x:name="projectnaam" displaymemberpath="projectnaam" itemssource="{binding static.projecten, relativesource={relativesource mode=findancestor, ancestortype=controls:metrowindow}}"/>

but doesn't work.

please help me either prepare databinding or help me set datacontext of window datacontext behind mainwindow.

i've have acces datacontext create window, how that:

nieuwsimulatie niewsimulatiewindow = new nieuwsimulatie() { owner = this, datacontext = yourdatacontext; }; bool? simulatieaangemaakt = niewsimulatiewindow.showdialog();

c# wpf data-binding

No comments:

Post a Comment