I have a listbox that gets a list of recipes from a repository class, and when i select a recipe from the listbox, i want to populate a usercontrol with the details. My issue is in populating the usercontrol. I have a property ActiveRecipe
public Recipe ActiveRecipe
{
get
{
return _activeRecipe;
}
set
{
_activeRecipe = value;
RaisePropertyChanged("ActiveRecipe");
}
}
When an item is selected from the listbox, I call
public RecipeSearchResults SelectedRecipe
{
get
{
return _selectedRecipe;
}
set
{
_selectedRecipe = value;
RaisePropertyChanged("SelectedRecipe");
RecordSelector(value);
}
}
private void RecordSelector(RecipeSearchResults value)
{
if (value == null) return;
try
{
this.ActiveRecipe = _recipeRepository.GetById(value.Id);
}
catch (Exception)
{
}
}
I am binding in the control in the following manner
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Path=ActiveRecipe.Name, Mode=TwoWay}" />
Is there something obvious that I am missing?
It seems like it should be working for me, but when I step through it, I never hit the get in the ActiveRecipe property.

New Topic/Question
Reply




MultiQuote



|