WPF載入等待動畫

2021-09-19 21:20:55 字數 2989 閱讀 5110

原文:

wpf載入等待動畫

介面遮罩

等待動畫全域性顏色

等待動畫中的小圓

後台業務**,新增了幾項屬性、動畫控制、小圓的位置設定

/// /// loadingwait.xaml 的互動邏輯

///

public partial class loadingwait : usercontrol

set

}// using a dependencyproperty as the backing store for textsize. this enables animation, styling, binding, etc...

public static readonly dependencyproperty textsizeproperty =

dependencyproperty.register("textsize", typeof(int), typeof(loadingwait), new propertymetadata(

defaultvalue: 24,

propertychangedcallback: new propertychangedcallback(

(sender, e) =>

})));

public color textcolor

set

}// using a dependencyproperty as the backing store for textcolor. this enables animation, styling, binding, etc...

public static readonly dependencyproperty textcolorproperty =

dependencyproperty.register("textcolor", typeof(color), typeof(loadingwait), new propertymetadata(

defaultvalue: colors.black,

propertychangedcallback: new propertychangedcallback(

(sender, e) =>

}),coercevaluecallback: new coercevaluecallback((sender, e) =>

catch(exception ex)

})));

public string text

set

}// using a dependencyproperty as the backing store for text. this enables animation, styling, binding, etc...

public static readonly dependencyproperty textproperty =

dependencyproperty.register("text", typeof(string), typeof(loadingwait), new propertymetadata(

defaultvalue: string.empty,

propertychangedcallback: new propertychangedcallback(

(sender, e) =>

})));

public string tip

set

}// using a dependencyproperty as the backing store for tip. this enables animation, styling, binding, etc...

public static readonly dependencyproperty tipproperty =

dependencyproperty.register("tip", typeof(string), typeof(loadingwait), new propertymetadata(

defaultvalue: string.empty,

propertychangedcallback: new propertychangedcallback(

(sender, e) =>

})));

#endregion

#region constructor

public loadingwait()

#endregion

#region private methods

private void start()

private void stop()

private void handleanimationtick(object sender, eventargs e)

private void handleloaded(object sender, routedeventargs e)

//設定動畫中小圓的位置

private void setposition(ellipse ellipse, double offset,

double posoffset, double step)

private void handleunloaded(object sender, routedeventargs e)

//顯示控制項就啟動動畫,隱藏(不顯示)就停止動畫

private void handlevisiblechanged(object sender,

dependencypropertychangedeventargs e)

#endregion

}

視窗載入時等待動畫

開始想要用gif格式的動畫作為視窗載入時的動畫,可是試了之後沒辦法去除的空白,所以網上搜了搜重寫的控制項,發現下面這個挺好用的,不過樣式只有一種但是具體資訊可以自己設定。首先要先建立乙個控制項類,這個類照搬就行,加點命名空間,沒有太大變化。namespace lodingcircle endregi...

wpf 動畫 WPF中監視動畫進度

前台xaml 1.新增乙個progressbar監視進度,注意這裡最大值設定為1,因為動畫始終clock的currentprocess屬性最大值是1。2.響應故事板的currenttimeinvalidated事件 後台 該事件在動畫前進乙個步長時發生 private void storyboard...

wpf動畫概述

windows presentation foundation wpf 提供了一組強大的圖形和布局功能,通過應用這些功能,可以建立漂亮的使用者介面和吸引人的文件。動畫不僅可以使漂亮的使用者介面更加引人注目,還可以使其更加便於使用。只需對背景色進行動畫處理或應用動畫transform,就可以創造出生動...