Hi,
After finishing my AutoCompleteSearchBox UserControl, I now attempt to make it reusable. Therefore, I need to expose some dependency properties such asIList<object> SearchSource and string SearchSourceType.
This is the UserControl:
public partial class SearchBox : UserControl
{public string SearchSourceType { get { return (string)GetValue(SearchSourceTypeProperty); } set { SetValue(SearchSourceTypeProperty, value); } } public static readonly DependencyProperty SearchSourceTypeProperty = DependencyProperty.Register("SearchSourceType", typeof(string), typeof(SearchBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.AffectsRender, new PropertyChangedCallback(OnPropertyChanged)));
And this is how I use it in another window:
<sb:SearchBox SearchSourceType="{Binding SearchSourceType}"/>
The problem is, OnPropertyChanged never gets called. When I replace the binding with a simple string, it is called just fine. I tried binding it to a different element that I can see to make sure the binding is fine.
Something that might be important to note...the binding is done from a UserControl that is bound to his ViewModel by DataTemplate.
Any help would be apreaciated!