本文整理汇总了C#中DataContextChangedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# DataContextChangedEventArgs类的具体用法?C# DataContextChangedEventArgs怎么用?C# DataContextChangedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataContextChangedEventArgs类属于命名空间,在下文中一共展示了DataContextChangedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UserControl_DataContextChanged
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
Graph.ClearSeries();
var item = DataContext as ChartSong;
if (item == null) return;
var color = Colors.White;
switch (item.ChangeDirection)
{
case ChartSong.Direction.Up:
color = Colors.Green;
break;
case ChartSong.Direction.Down:
color = Colors.Red;
break;
}
ChangePercentBlock.Foreground = new SolidColorBrush(color);
var data = item.Signals.Select((p, i) => new Point(i, p)).ToList();
var serie = new Serie("Signals") {ShiftSize = 100};
serie.SetData(data);
Graph.AutoRedraw = true;
Graph.AddSerie(serie);
}
示例2: UserControl_DataContextChanged
private async void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (args.NewValue != null)
contentSection.Content = await ContentPreviewConverter.MakePreviewControl(args.NewValue as LinkViewModel, SnooStreamViewModel.UIContextCancellationToken, null, true);
else
contentSection.Content = null;
}
示例3: MenuControl_DataContextChanged
private void MenuControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
var propertyChanged = PropertyChanged;
if (propertyChanged != null) {
propertyChanged(this, new PropertyChangedEventArgs(nameof(ConcreteDataContext)));
}
}
示例4: UserControl_DataContextChanged
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (args.NewValue is IPinViewModel)
{
(args.NewValue as IPinViewModel).PropertyChanged += ViewModel_PropertyChanged;
}
}
示例5: OnDataContextChanged
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (DataContext == null)
return;
ViewModel.AnimeItemDisplayContext = DisplayContext;
Bindings.Update();
}
示例6: OnDataContextChanged
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
var m = this.DataContext as MessageRecord;
if (m != null)
{
this.MessageRecord = m;
VisualStateManager.GoToState(this, m.IsOutgoing ? "Outgoing" : "Incoming", true);
if (m.IsFailed)
{
VisualStateManager.GoToState(this, "Failed", true);
}
else
{
if (!m.IsOutgoing) VisualStateManager.GoToState(this, "None", true);
else if (m.IsPending) VisualStateManager.GoToState(this, "Pending", true);
else if (m.IsDelivered) VisualStateManager.GoToState(this, "Delivered", true);
else VisualStateManager.GoToState(this, "Sent", true);
}
if (m.IsKeyExchange)
{
VisualStateManager.GoToState(this, "KeyExchange", true);
}
}
}
示例7: UserControl_DataContextChanged
private void UserControl_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (args.NewValue != null && args.NewValue is Preview && !string.IsNullOrWhiteSpace(((Preview)args.NewValue).HQThumbnailUrl))
imageControl.Opacity = 0;
else
imageControl.Opacity = 1;
}
示例8: WV_DataContextChanged
private void WV_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
if (args.NewValue != null)
{
string content = args.NewValue as string;
this.WV.NavigateToString(content);
}
}
示例9: albumSlideView_DataContextChanged
private async void albumSlideView_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
var loader = albumSlideView.ItemsSource as ISupportIncrementalLoading;
if (albumSlideView.Items.Count == 0 && loader != null)
{
if (loader.HasMoreItems)
await loader.LoadMoreItemsAsync(20);
}
}
示例10: OnDataContextChanged
private void OnDataContextChanged(object sender, DataContextChangedEventArgs e)
{
IAmbientColor ambientColor = e.NewValue as IAmbientColor;
if (ambientColor != null) {
ambientColor.AmbientColorChanged += (s, ae) => OnAmbientColorChanged(ae);
}
}
示例11: OnDataContextChanged
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
OnPropertyChanged(nameof(ViewModel));
var newVm = (EntryListItemViewModel)args.NewValue;
if (newVm != null)
{
newVm.View = this;
}
}
示例12: OnDataContextChanged
private void OnDataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
var m = this.DataContext as MessageRecord;
if (m != null)
{
this.MessageRecord = m;
Update();
}
}
示例13: OnDataContextChanged
private void OnDataContextChanged(FrameworkElement s, DataContextChangedEventArgs e) {
if (ViewModel != null)
ViewModel.PropertyChanged -= ViewModelOnPropertyChanged;
ViewModel = DataContext as PostViewModel;
if (ViewModel != null) {
if (ViewModel.ShortenText)
this.PostText.MaxLines = SettingsService.MaxLinesInBoard;
ViewModel.PropertyChanged += ViewModelOnPropertyChanged;
IsRepliesButtonVisible = ViewModel.AreRepliesVisible && ShowRepliesAsRibbon;
AreRepliesVisible = ViewModel.AreRepliesVisible && !ShowRepliesAsRibbon;
}
}
示例14: MonsterListView_DataContextChanged
private void MonsterListView_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
try
{
if (this.DataContext != null)
MonsterGridView.DataContext = new ObservableCollection<Monster>(this.DataContext as List<Monster>);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
示例15: lpProtocolItem_DataContextChanged
private void lpProtocolItem_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
{
var cbi = lpProtocol.ContainerFromItem(args.NewValue) as ComboBoxItem;
if (cbi != null)
{
var val = (LocomotiveProtocolType) args.NewValue;
var isDisabled = val == LocomotiveProtocolType.M4 || val == LocomotiveProtocolType.MULTI;
cbi.IsHitTestVisible = !isDisabled;
cbi.Foreground = (Brush)(isDisabled ? Resources["SystemControlDisabledBaseLowBrush"] : Resources["SystemControlForegroundChromeWhiteBrush"]);
}
}