#region Trends
/// <summary>
/// Trends Dependency Property
/// </summary>
public static readonly DependencyProperty TrendsProperty =
DependencyProperty.Register("Trends", typeof(ObservableCollection<Trend>), typeof(TwitterPage),
new PropertyMetadata((ObservableCollection<Trend>)null));
/// <summary>
/// Gets or sets the Trends property. This dependency property
/// indicates what are the current twitter trends.
/// </summary>
public ObservableCollection<Trend> Trends
{
get { return (ObservableCollection<Trend>)GetValue(TrendsProperty); }
set { SetValue(TrendsProperty, value); }
}
#endregion
#region CurrentTrend
/// <summary>
/// CurrentTrend Dependency Property
/// </summary>
public static readonly DependencyProperty CurrentTrendProperty =
DependencyProperty.Register("CurrentTrend", typeof(Trend), typeof(TwitterPage),
new PropertyMetadata((Trend)null,
new PropertyChangedCallback(OnCurrentTrendChanged)));
/// <summary>
/// Gets or sets the CurrentTrend property. This dependency property
/// indicates what is the current trend.
/// </summary>
public Trend CurrentTrend
{
get { return (Trend)GetValue(CurrentTrendProperty); }
set { SetValue(CurrentTrendProperty, value); }
}
/// <summary>
/// Handles changes to the CurrentTrend property.
/// </summary>
private static void OnCurrentTrendChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
TwitterPage target = (TwitterPage)d;
Trend oldCurrentTrend = (Trend)e.OldValue;
Trend newCurrentTrend = target.CurrentTrend;
target.OnCurrentTrendChanged(oldCurrentTrend, newCurrentTrend);
}
/// <summary>
/// Provides derived classes an opportunity to handle changes to the CurrentTrend property.
/// </summary>
protected virtual void OnCurrentTrendChanged(Trend oldCurrentTrend, Trend newCurrentTrend)
{
if (newCurrentTrend != oldCurrentTrend)
{
Dispatcher.BeginInvoke((Action)delegate
{
PivotControl.SelectedItem = newCurrentTrend;
});
}
}
#endregion
#region IsTwitsLoading
/// <summary>
/// IsTwitsLoading Dependency Property
/// </summary>
public static readonly DependencyProperty IsTwitsLoadingProperty =
DependencyProperty.Register("IsTwitsLoading", typeof(bool), typeof(TwitterPage),
new PropertyMetadata((bool)false));
/// <summary>
/// Gets or sets the IsTwitsLoading property. This dependency property
/// indicates whether we are currently loading twits.
/// </summary>
public bool IsTwitsLoading
{
get { return (bool)GetValue(IsTwitsLoadingProperty); }
set { SetValue(IsTwitsLoadingProperty, value); }
}
#endregion