Click here to Skip to main content
15,033,877 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: DispatcherTimer Pin
Dave Kreskowiak8-Dec-20 4:15
mveDave Kreskowiak8-Dec-20 4:15 
GeneralRe: DispatcherTimer Pin
michaelbarb8-Dec-20 4:24
Membermichaelbarb8-Dec-20 4:24 
AnswerRe: DispatcherTimer Pin
Gerry Schmitz8-Dec-20 6:30
mveGerry Schmitz8-Dec-20 6:30 
GeneralRe: DispatcherTimer Pin
michaelbarb8-Dec-20 6:37
Membermichaelbarb8-Dec-20 6:37 
QuestionDifferences Pin
michaelbarb30-Nov-20 6:36
Membermichaelbarb30-Nov-20 6:36 
AnswerRe: Differences Pin
Richard MacCutchan30-Nov-20 6:45
mveRichard MacCutchan30-Nov-20 6:45 
AnswerMessage Closed Pin
9-Jan-21 22:49
MemberMEGA_REALTY9-Jan-21 22:49 
QuestionDependencyProperty Binding Problem Pin
Kevin Marois2-Oct-20 6:02
professionalKevin Marois2-Oct-20 6:02 
I have a UserControl on a TabView that has a DependencyProperty of type Project. Project is an object.
public static readonly DependencyProperty ProjectProperty =
            DependencyProperty.Register("Project",
            typeof(ProjectEntity),
            typeof(PurchaseOrderView),
            new PropertyMetadata(null, new PropertyChangedCallback(OnProjectChanged)));

public ProjectEntity Project
{
    get { return (ProjectEntity)GetValue(ProjectProperty); }
    set { SetValue(ProjectProperty, value); }
}

private static void OnProjectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    PurchaseOrderView control = (PurchaseOrderView)d;
    control.LoadPurchaseOrders();
}
<h1>endregion</h1>
When the control is first loaded, and the binding occurs, Project is set to the instance, and everything works fine.

However, when I select another tab, the control's CTOR and DP's Changed method fire AGAIN and now Project is Null and casues null ref exceptions.

I'm not really sure what's going on. Is it unbinding somehow?? I don't really know how to diagnose this.

I found this article that discusses the Tab Control removing and replacing its content when the tabs change, and I tried using the solution, but it doesn't work.

Anyone have an ideas?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.


modified 2-Oct-20 12:49pm.

QuestionReuseable Triggers? Pin
Kevin Marois18-Sep-20 9:07
professionalKevin Marois18-Sep-20 9:07 
Questionload usercontrol in background worker Pin
Rusdy Perkasa8-Sep-20 21:31
MemberRusdy Perkasa8-Sep-20 21:31 
AnswerRe: load usercontrol in background worker Pin
Gerry Schmitz9-Sep-20 4:22
mveGerry Schmitz9-Sep-20 4:22 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa9-Sep-20 20:06
MemberRusdy Perkasa9-Sep-20 20:06 
AnswerRe: load usercontrol in background worker Pin
Dave Kreskowiak9-Sep-20 4:46
mveDave Kreskowiak9-Sep-20 4:46 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa9-Sep-20 20:14
MemberRusdy Perkasa9-Sep-20 20:14 
GeneralRe: load usercontrol in background worker Pin
Dave Kreskowiak10-Sep-20 3:50
mveDave Kreskowiak10-Sep-20 3:50 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa10-Sep-20 15:56
MemberRusdy Perkasa10-Sep-20 15:56 
GeneralRe: load usercontrol in background worker Pin
Dave Kreskowiak10-Sep-20 16:29
mveDave Kreskowiak10-Sep-20 16:29 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa10-Sep-20 17:15
MemberRusdy Perkasa10-Sep-20 17:15 
GeneralRe: load usercontrol in background worker Pin
Dave Kreskowiak10-Sep-20 18:02
mveDave Kreskowiak10-Sep-20 18:02 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa10-Sep-20 18:41
MemberRusdy Perkasa10-Sep-20 18:41 
GeneralRe: load usercontrol in background worker Pin
Dave Kreskowiak11-Sep-20 2:32
mveDave Kreskowiak11-Sep-20 2:32 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa11-Sep-20 17:13
MemberRusdy Perkasa11-Sep-20 17:13 
GeneralRe: load usercontrol in background worker Pin
Dave Kreskowiak11-Sep-20 18:36
mveDave Kreskowiak11-Sep-20 18:36 
GeneralRe: load usercontrol in background worker Pin
Gerry Schmitz11-Sep-20 9:29
mveGerry Schmitz11-Sep-20 9:29 
GeneralRe: load usercontrol in background worker Pin
Rusdy Perkasa11-Sep-20 17:20
MemberRusdy Perkasa11-Sep-20 17:20 

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.