Click here to Skip to main content
15,445,560 members
Home / Discussions / WPF
   

WPF

 
QuestionUser Control Confusion Pin
Kevin Marois3-Apr-14 8:25
professionalKevin Marois3-Apr-14 8:25 
AnswerRe: User Control Confusion Pin
Richard Deeming3-Apr-14 10:23
mveRichard Deeming3-Apr-14 10:23 
GeneralRe: User Control Confusion Pin
Kevin Marois3-Apr-14 11:14
professionalKevin Marois3-Apr-14 11:14 
QuestionWPF Ribbon Control Pin
Sujit Keng2-Apr-14 21:51
MemberSujit Keng2-Apr-14 21:51 
AnswerRe: WPF Ribbon Control Pin
Naz_Firdouse8-Apr-14 3:07
MemberNaz_Firdouse8-Apr-14 3:07 
QuestionToolTip is not fully visible Pin
SRKSHOME2-Apr-14 0:42
MemberSRKSHOME2-Apr-14 0:42 
QuestionBind Grid Row's IsExpanded To Row's Data Object Pin
Kevin Marois31-Mar-14 12:41
professionalKevin Marois31-Mar-14 12:41 
QuestionUser Control Question Pin
Kevin Marois25-Mar-14 8:05
professionalKevin Marois25-Mar-14 8:05 
This is a bit long, and I'm not entirely sure how to word my question...

I am developing a prototype for a simple lookup control[^].

The source is here[^].

The Category combo is on the window, and below it is my control. When a category is selected, I want the Lookup control to get the category Id:

<ComboBox x:Name="CategoryCombo"
            Grid.Row="1"
            ItemsSource="{Binding Categories}"
            SelectedValuePath="Id"
            DisplayMemberPath="Category"
            VerticalAlignment="Center"
            Height="24"
            Width="375"/>

<views:LookupComboControl Grid.Row="2"
                            CategoryId="{Binding ElementName=CategoryCombo, Path=SelectedValue, Mode=TwoWay}"
                            Height="70"
                            Width="400"/>



My Lookup control's VM is pretty simple:

public class LookupComboControlViewModel : _ModelBase
{
    private List<PersonModel> _People = new List<PersonModel>();
    public List<PersonModel> People
    {
        get { return _People; }
        set
        {
            if (_People != value)
            {
                _People = value;
                RaisePropertyChanged("ComboSourceData");
            }
        }
    }

    private string _CategoryName;
    public string CategoryName
    {
        get { return _CategoryName; }
        set
        {
            if (_CategoryName != value)
            {
                _CategoryName = value;
                RaisePropertyChanged("CategoryName");
            }
        }
    }

    private int _CategoryId;
    public int CategoryId
    {
        get { return _CategoryId; }
        set
        {
            if (_CategoryId != value)
            {
                _CategoryId = value;
                RaisePropertyChanged("CategoryId");

                loadData();
            }
        }
    }

    private void loadData()
    {
        DAL dal = new DAL();

        People = dal.GetPeopleForCategory(CategoryId);
    }
}


When a category is selected, I want to set the lookup control's CateogoryId. The lookup control has this DP in it.

public LookupComboControl()
{
    InitializeComponent();

    this.DataContext = new LookupComboControlViewModel();
}

public int CategoryId
{
    get { return (int)GetValue(CategoryIdProperty); }
    set { SetValue(CategoryIdProperty, value); }
}

public static readonly DependencyProperty CategoryIdProperty =
    DependencyProperty.Register("CategoryId", typeof(int), typeof(LookupComboControl));



The ultimate goal is to have the VM for the Lookup control know when the CategoryId was set. When I select a cateogory, nothing happens. What am I doing wrong here?

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


modified 25-Mar-14 14:16pm.

AnswerRe: User Control Question Pin
_Maxxx_2-Apr-14 18:39
professional_Maxxx_2-Apr-14 18:39 
GeneralRe: User Control Question Pin
Kevin Marois2-Apr-14 18:49
professionalKevin Marois2-Apr-14 18:49 
GeneralRe: User Control Question Pin
_Maxxx_2-Apr-14 19:36
professional_Maxxx_2-Apr-14 19:36 
GeneralRe: User Control Question Pin
Kevin Marois3-Apr-14 5:47
professionalKevin Marois3-Apr-14 5:47 
GeneralRe: User Control Question Pin
BubingaMan23-Apr-14 4:13
MemberBubingaMan23-Apr-14 4:13 
QuestionPrefixing ListBoxItem index in DataTemplate Pin
Dominick Marciano22-Mar-14 21:33
professionalDominick Marciano22-Mar-14 21:33 
AnswerRe: Prefixing ListBoxItem index in DataTemplate Pin
SledgeHammer0123-Mar-14 9:22
MemberSledgeHammer0123-Mar-14 9:22 
GeneralRe: Prefixing ListBoxItem index in DataTemplate Pin
Dominick Marciano25-Mar-14 4:42
professionalDominick Marciano25-Mar-14 4:42 
GeneralRe: Prefixing ListBoxItem index in DataTemplate Pin
SledgeHammer0125-Mar-14 4:55
MemberSledgeHammer0125-Mar-14 4:55 
QuestionCustom Window WPF con Vb.Net Pin
Pablo Roberto Cuellar Ribera21-Mar-14 9:59
MemberPablo Roberto Cuellar Ribera21-Mar-14 9:59 
AnswerRe: Custom Window WPF con Vb.Net Pin
Kenneth Haugland21-Mar-14 10:11
mvaKenneth Haugland21-Mar-14 10:11 
GeneralRe: Custom Window WPF con Vb.Net Pin
Pablo Roberto Cuellar Ribera21-Mar-14 10:40
MemberPablo Roberto Cuellar Ribera21-Mar-14 10:40 
QuestionRe: Custom Window WPF con Vb.Net Pin
Kenneth Haugland23-Mar-14 10:49
mvaKenneth Haugland23-Mar-14 10:49 
AnswerRe: Custom Window WPF con Vb.Net Pin
Meshack Musundi24-Mar-14 20:04
professionalMeshack Musundi24-Mar-14 20:04 
GeneralRe: Custom Window WPF con Vb.Net Pin
Pablo Roberto Cuellar Ribera28-Mar-14 5:58
MemberPablo Roberto Cuellar Ribera28-Mar-14 5:58 
QuestionWPF problem with ScrollViewer Pin
Federico Barbieri20-Mar-14 23:48
MemberFederico Barbieri20-Mar-14 23:48 
AnswerRe: WPF problem with ScrollViewer Pin
Pete O'Hanlon21-Mar-14 0:08
mvaPete O'Hanlon21-Mar-14 0:08 

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.