本文整理匯總了C#中Windows.UI.Xaml.DependencyPropertyChangedEventArgs類的典型用法代碼示例。如果您正苦於以下問題:C# DependencyPropertyChangedEventArgs類的具體用法?C# DependencyPropertyChangedEventArgs怎麽用?C# DependencyPropertyChangedEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
DependencyPropertyChangedEventArgs類屬於Windows.UI.Xaml命名空間,在下文中一共展示了DependencyPropertyChangedEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: EffectChanged
private static void EffectChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var uiSender = d as UIElement;
var effect = e.NewValue as IComposition;
effect.Initialize(uiSender);
}
示例2: OnMessageChanged
private static void OnMessageChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var notifybar = d as NotificationBar;
var message = e.NewValue as string;
if (message == string.Empty) return;
notifybar?.ShowMessage(message);
}
示例3: SizeChanged
private static async void SizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) {
if ((int)e.NewValue <= 0)
throw new ArgumentException("ThumbImageSource width/height 必須大於0");
var thumb = (ThumbImageSource)d;
//await thumb.Deal();
}
示例4: OnSourceChanged
// 依存関係プロパティに値がセットされたときに呼び出されるメソッド
private static void OnSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var i = d as TwitterSuggestTextBox;
i.textBoxTweet.Text = (string)e.NewValue;
// i.model.Text = (string)e.NewValue;
}
示例5: OnMaskChanged
private static void OnMaskChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var target = (TextBoxMaskBehavior)sender;
var oldMask = (TextMask)e.OldValue;
var newMask = (TextMask)e.NewValue;
target.OnMaskChanged(oldMask, newMask);
}
示例6: OnHeaderTemplatePropertyChanged
private static void OnHeaderTemplatePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var source = d as HeaderedItemsControl;
var oldHeaderTemplate = e.OldValue as DataTemplate;
var newHeaderTemplate = e.NewValue as DataTemplate;
if (source != null) source.OnHeaderTemplateChanged(oldHeaderTemplate, newHeaderTemplate);
}
示例7: PositionChanged
static void PositionChanged(DependencyObject dp, DependencyPropertyChangedEventArgs args)
{
var p = ((FrameworkElement)dp)?.Parent;
if (p == null)
return;
((UIElement)p)?.InvalidateArrange();
}
示例8: OnBaterryPercentagePropertyChanged
private static void OnBaterryPercentagePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var obj = (BatteryPercentageTrigger)d;
var val = (BaterryPercentageState)e.NewValue;
obj.SetActive(val == _batteryPercentageState);
}
示例9: OnRatioVisibleChanged
/// <summary>
/// RatioVisibleProperty property changed handler.
/// </summary>
/// <param name="d">PartialView that changed its RatioVisible.</param>
/// <param name="e">Event arguments.</param>
private static void OnRatioVisibleChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Clipper source = (Clipper)d;
double oldValue = (double)e.OldValue;
double newValue = (double)e.NewValue;
source.OnRatioVisibleChanged(oldValue, newValue);
}
示例10: OnExpandDirectionChanged
/// <summary>
/// ExpandDirectionProperty property changed handler.
/// </summary>
/// <param name="d">ExpandDirectionView that changed its ExpandDirection.</param>
/// <param name="e">Event arguments.</param>
private static void OnExpandDirectionChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
LinearClipper source = (LinearClipper)d;
ExpandDirection oldValue = (ExpandDirection)e.OldValue;
ExpandDirection newValue = (ExpandDirection)e.NewValue;
source.OnExpandDirectionChanged(oldValue, newValue);
}
示例11: OnSearchTermChanged
private static void OnSearchTermChanged(DependencyObject d, DependencyPropertyChangedEventArgs args) {
var textBlock = (TextBlock)d;
if (textBlock == null) return;
var searchTerm = GetSearchTerm(textBlock);
var originalText = GetSearchText(textBlock);
if (string.IsNullOrEmpty(originalText) || (searchTerm == null)) return;
if (searchTerm.Length == 0) {
textBlock.Text = originalText;
return;
}
textBlock.Inlines.Clear();
var currentIndex = 0;
var searchTermLength = searchTerm.Length;
int index = originalText.IndexOf(searchTerm, 0, StringComparison.CurrentCultureIgnoreCase);
while (index > -1) {
textBlock.Inlines.Add(new Run() { Text = originalText.Substring(currentIndex, index - currentIndex) });
currentIndex = index + searchTermLength;
textBlock.Inlines.Add(new Run() { Text = originalText.Substring(index, searchTermLength), Foreground = GetHighlightBrush(textBlock) });
index = originalText.IndexOf(searchTerm, currentIndex, 0, StringComparison.CurrentCultureIgnoreCase);
}
textBlock.Inlines.Add(new Run() { Text = originalText.Substring(currentIndex) });
}
示例12: OnSecondsChanged
private static void OnSecondsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var target = (CountdownControl)sender;
var oldSeconds = (int)e.OldValue;
var newSeconds = (int)e.NewValue;
target.OnSecondsChanged(oldSeconds, newSeconds);
}
示例13: OnButtonForegroundColorPropertyChanged
private static void OnButtonForegroundColorPropertyChanged(DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
var color = (Color)e.NewValue;
var titleBar = ApplicationView.GetForCurrentView().TitleBar;
titleBar.ButtonForegroundColor = color;
}
示例14: HtmlChanged
/// <summary>
/// Handles the HTML has changed, converts it and attach to the attached RichTextBlock.
/// </summary>
/// <param name="d">The RichTextBlock.</param>
/// <param name="e">The <see cref="DependencyPropertyChangedEventArgs"/> instance containing the event data.</param>
private static async void HtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
RichTextBlock richText = d as RichTextBlock;
string html = e.NewValue as string;
if (richText != null && !string.IsNullOrEmpty(html))
{
try
{
if (!ContainsHtmlTags(html))
{
html = html.Replace("\r\n", "<br/>");
html = html.Replace("\n\r", "<br/>");
html = html.Replace("\n", "<br/>");
}
string xaml = await Html2XamlProcessor.ConvertToXaml(html);
ChangeRichTextBlockContents(richText, xaml);
}
catch (Exception ex)
{
Debug.WriteLine(ex);
try
{
ChangeRichTextBlockContents(richText, GetErrorXaml(ex, html));
}
catch
{
Debug.WriteLine(ex);
}
}
}
}
示例15: OnPathChanged
private static void OnPathChanged( DependencyObject obj, DependencyPropertyChangedEventArgs args )
{
var icon = (Icon) obj;
var data = (string) args.NewValue;
if ( data == null )
{
return;
}
// Copy it since sharing it isn't permitted
var path = (Path) XamlReader.Load( "<Path xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Data=\"" + data + "\" />" );
path.Stretch = Stretch.Uniform;
path.HorizontalAlignment = HorizontalAlignment.Center;
path.VerticalAlignment = VerticalAlignment.Center;
path.SetBinding( Path.FillProperty, new Binding { Source = icon, Path = new PropertyPath( "Foreground" ) } );
path.SetBinding( Path.MarginProperty, new Binding { Source = icon, Path = new PropertyPath( "Padding" ) } );
var container = new Border
{
Child = path
};
container.SetBinding( Border.WidthProperty, new Binding { Source = icon, Path = new PropertyPath( "IconWidth" ) } );
container.SetBinding( Border.HeightProperty, new Binding { Source = icon, Path = new PropertyPath( "IconHeight" ) } );
container.SetBinding( Border.BackgroundProperty, new Binding { Source = icon, Path = new PropertyPath( "Background" ) } );
icon.HorizontalAlignment = HorizontalAlignment.Center;
icon.VerticalAlignment = VerticalAlignment.Center;
icon.Content = new Viewbox
{
Child = container
};
}