Click here to Skip to main content
14,383,811 members
   

C#

 
QuestionUsing Microsoft Agent with C# for win7 or win10 ? Pin
Member 245846724-Oct-19 19:20
memberMember 245846724-Oct-19 19:20 
AnswerRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Richard MacCutchan24-Oct-19 22:54
protectorRichard MacCutchan24-Oct-19 22:54 
GeneralRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Member 245846727-Oct-19 22:04
memberMember 245846727-Oct-19 22:04 
GeneralRe: Using Microsoft Agent with C# for win7 or win10 ? Pin
Richard MacCutchan27-Oct-19 23:10
protectorRichard MacCutchan27-Oct-19 23:10 
Questioni want count rows per same date in new one row. c# with sqlserver Pin
Mostafa Mohamed23-Oct-19 23:06
memberMostafa Mohamed23-Oct-19 23:06 
AnswerRe: i want count rows per same date in new one row. c# with sqlserver Pin
OriginalGriff23-Oct-19 23:22
protectorOriginalGriff23-Oct-19 23:22 
QuestionHow do I bind TreeView Selected Item? Pin
JohNYC42022-Oct-19 20:52
memberJohNYC42022-Oct-19 20:52 
AnswerRe: How do I bind TreeView Selected Item? Pin
Mc_Topaz24-Oct-19 22:00
memberMc_Topaz24-Oct-19 22:00 
Shouldn't that just be:
<TreeView SelectedItem="{Binding SelectedPerson, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
Then in your view model you must have a property to connect the binding:
class ViewModel
{
    public Person SelectedPerson { get; set; }
}
However, you don't seem to have a view model for the entire TreeView.
I think you can set the TreeView's DataContect to an instance of the ViewModel.
For instance:
trVwPerson.DataContext = new ViewModel()
But instead I suggest you specify the ViewModel to the MainWindow/UserControl containing the TreeView. For instance: You have your TreeView in your MainWindow or maybe a UserControl to contain the TreeView. For that container specify its DataContext to an instance of the ViewModel.
class MainWindow
{
    // Note: Make sure your TreeView is contained in the MainWindow's XAML-code.

    public MainWindow()
    {
        this.DataContext = new ViewModel();
    }
}

You also need to implement the INotifyPropertyChanged in the ViewModel.
However this is kinda clunky, ugly and tedious. Instead I recommend you use an automatic implementation of INotifyPropertyChanged as a NuGet-package. For instance: PropertyChanged.


I think that should give you some advice how fix your problem.
I have note tested my code, so have in mind if it's now is working right off.


Best regards,
/Steffe
QuestionWhy does the Form_Paint event run continuously and only draw once ? Pin
Member 245846722-Oct-19 16:53
memberMember 245846722-Oct-19 16:53 
AnswerRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak22-Oct-19 18:56
mveDave Kreskowiak22-Oct-19 18:56 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846723-Oct-19 23:09
memberMember 245846723-Oct-19 23:09 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 5:33
mveDave Kreskowiak24-Oct-19 5:33 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846724-Oct-19 17:59
memberMember 245846724-Oct-19 17:59 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 19:04
mveDave Kreskowiak24-Oct-19 19:04 
GeneralC # Pin
Member 1461982622-Oct-19 1:45
memberMember 1461982622-Oct-19 1:45 
GeneralRe: C # Pin
OriginalGriff22-Oct-19 1:57
protectorOriginalGriff22-Oct-19 1:57 
QuestionRe: C # Pin
ZurdoDev22-Oct-19 3:59
professionalZurdoDev22-Oct-19 3:59 
AnswerRe: C # Pin
OriginalGriff22-Oct-19 4:32
protectorOriginalGriff22-Oct-19 4:32 
GeneralRe: C # Pin
ZurdoDev22-Oct-19 5:04
professionalZurdoDev22-Oct-19 5:04 
GeneralRe: C # Pin
Dave Kreskowiak22-Oct-19 7:07
mveDave Kreskowiak22-Oct-19 7:07 
GeneralRe: C # Pin
Luc Pattyn22-Oct-19 11:23
professionalLuc Pattyn22-Oct-19 11:23 
GeneralRe: C # Pin
Richard Deeming23-Oct-19 2:25
mveRichard Deeming23-Oct-19 2:25 
GeneralRe: C # Pin
Luc Pattyn23-Oct-19 3:56
professionalLuc Pattyn23-Oct-19 3:56 
QuestionLDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Super Lloyd21-Oct-19 22:30
memberSuper Lloyd21-Oct-19 22:30 
SuggestionRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Richard MacCutchan21-Oct-19 23:41
protectorRichard MacCutchan21-Oct-19 23:41 

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.