Click here to Skip to main content
15,912,977 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: a question about MVVM Pin
Richard MacCutchan12-Sep-13 23:56
mveRichard MacCutchan12-Sep-13 23:56 
QuestionHow to create appointment in radscheduleview programatically from another window Pin
ramkie12-Sep-13 1:42
ramkie12-Sep-13 1:42 
AnswerRe: How to create appointment in radscheduleview programatically from another window Pin
Pete O'Hanlon12-Sep-13 2:55
mvePete O'Hanlon12-Sep-13 2:55 
QuestionWPF/MVVM App On WIndows 8 Tablet - Touch Doesn't Work Pin
Kevin Marois11-Sep-13 6:02
professionalKevin Marois11-Sep-13 6:02 
AnswerRe: WPF/MVVM App On WIndows 8 Tablet - Touch Doesn't Work Pin
Punamchand Dhuppad19-Sep-13 18:10
professionalPunamchand Dhuppad19-Sep-13 18:10 
QuestionWPF DataGrid with Bands Pin
Kevin Marois10-Sep-13 11:50
professionalKevin Marois10-Sep-13 11:50 
AnswerRe: WPF DataGrid with Bands Pin
SledgeHammer0110-Sep-13 13:23
SledgeHammer0110-Sep-13 13:23 
GeneralRe: WPF DataGrid with Bands Pin
Kevin Marois10-Sep-13 13:24
professionalKevin Marois10-Sep-13 13:24 
AnswerRe: WPF DataGrid with Bands Pin
Abhinav S10-Sep-13 16:57
Abhinav S10-Sep-13 16:57 
QuestionSave/Load view configuration to/from xml file Pin
columbos149278-Sep-13 2:23
columbos149278-Sep-13 2:23 
AnswerRe: Save/Load view configuration to/from xml file Pin
Mycroft Holmes10-Sep-13 15:06
professionalMycroft Holmes10-Sep-13 15:06 
AnswerRe: Save/Load view configuration to/from xml file Pin
Abhinav S10-Sep-13 16:59
Abhinav S10-Sep-13 16:59 
Questionquery using Lamda expression Pin
picasso27-Sep-13 19:26
picasso27-Sep-13 19:26 
AnswerRe: query using Lamda expression Pin
Matt T Heffron9-Sep-13 7:01
professionalMatt T Heffron9-Sep-13 7:01 
GeneralRe: query using Lamda expression Pin
picasso29-Sep-13 16:55
picasso29-Sep-13 16:55 
GeneralRe: query using Lamda expression Pin
Richard MacCutchan9-Sep-13 21:08
mveRichard MacCutchan9-Sep-13 21:08 
AnswerRe: query using Lamda expression Pin
koll Zhu22-Sep-13 23:43
koll Zhu22-Sep-13 23:43 
QuestionOpen a window after progress bar load completes Pin
TheUltimateDebugger6-Sep-13 19:22
professionalTheUltimateDebugger6-Sep-13 19:22 
AnswerRe: Open a window after progress bar load completes Pin
Richard Deeming9-Sep-13 1:39
mveRichard Deeming9-Sep-13 1:39 
GeneralRe: Open a window after progress bar load completes Pin
Joezer BH9-Sep-13 22:44
professionalJoezer BH9-Sep-13 22:44 
QuestionAnother DependencyProperty Question Pin
Kevin Marois5-Sep-13 16:11
professionalKevin Marois5-Sep-13 16:11 
I am still struggling to understand how to use DP's....

I am designing a Job Picker control[^]. The control is housed inside a Select Job window and also inside a wizard. When the user clicks a Job, I want that job exposed as a DP so the Window or Wizard know that a job was selected.

In the Window, when a Job is selected, the Select button will come on.

So in the control there is the tree:

<controls:TreeViewEx BorderThickness="0"
                        Margin="5"
                        ItemsSource="{Binding Jobs}"
                        SelectedItemEx="{Binding SelectedJob, Mode=TwoWay}"
                        IsManipulationEnabled ="True"/>


It's bound to Jobs and has it's SelectedItem bound to SelectedJob:

The JobListControl's VM is JobListViewModel:

#region Bound Properties
private ObservableCollection<JobSummaryModel> _Jobs;
public ObservableCollection<JobSummaryModel> Jobs
{
    get { return _Jobs; }
    set
    {
        if (_Jobs == value)
            return;

        _Jobs = value;
        RaisePropertyChanged("Jobs");
    }
}

private JobSummaryModel _SelectedJob;
public JobSummaryModel SelectedJob
{
    get { return _SelectedJob; }
    set
    {
        if (_SelectedJob == value)
            return;

        _SelectedJob = value;
        RaisePropertyChanged("SelectedJob");
    }
}
#endregion


This all works fine. When I click a Job in the tree, the SelectedJob property fires. So far so good.

Now, I need to expose the SelectedJob to the control's host (either the SelectJob window or the Wizard). So I went into the code behind and added a DP:

public partial class JobListView : UserControl
{
    public JobListView()
    {
        InitializeComponent();
    }

    #region SelectedJob DP
    public JobSummaryModel SelectedJob
    {
        get { return (JobSummaryModel)GetValue(SelectedJobProperty); }
        set { SetValue(SelectedJobProperty, value); }
    }

    public static readonly DependencyProperty SelectedJobProperty = DependencyProperty.Register("SelectedJob", typeof(JobSummaryModel),
          typeof(JobListView));
    #endregion
}


Next, in the Window's XAML I have:

<views:JobListView Grid.Row="0"
                   SelectedJob="{Binding Path=SelectedJob, Mode=TwoWay}"/>


The SelectJobWindowViewModel has a SelectedJob property of the same type as the JobListViewModel above;

The SelectJobWindowViewModel.SelectedJob property never fires.

I guess I was expecting the DP to pass the Selected Job from the control through to the Window.

Wat am I not seeing here?

Thanks
If it's not broken, fix it until it is

AnswerRe: Another DependencyProperty Question Pin
Pete O'Hanlon5-Sep-13 20:24
mvePete O'Hanlon5-Sep-13 20:24 
GeneralRe: Another DependencyProperty Question Pin
Kevin Marois6-Sep-13 3:50
professionalKevin Marois6-Sep-13 3:50 
GeneralRe: Another DependencyProperty Question Pin
SledgeHammer016-Sep-13 5:07
SledgeHammer016-Sep-13 5:07 
GeneralRe: Another DependencyProperty Question Pin
Jason Gleim6-Sep-13 5:23
professionalJason Gleim6-Sep-13 5:23 

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.