I love WPF

"jamais sans son interface"

I love WPF

"jamais sans son interface"

Month: octobre 2019

DoubleAnimation with Step

For having step working in double animation use public class DoubleAnimationStep : DoubleAnimationUsingKeyFrames { #region static static DoubleAnimationStep() { DurationProperty.OverrideMetadata(typeof(DoubleAnimationStep), new FrameworkPropertyMetadata(new Duration(), (ss,ee) => (ss as DoubleAnimationStep).Update())); } #endregion #region Step (DP SHORT) public int Step { get { return (int)GetValue(StepProperty); } set { SetValue(StepProperty, value); } } public static readonly DependencyProperty StepProperty = […]

Adding font in wpf application

For using a font in resource Add font ton project and set it as resource (for sample https://www.1001fonts.com/saligra-font.html) Use it in xaml as FontFamily= »./#Saligra » without extension sample <TextBlock Text= »SAMPLE » DockPanel.Dock= »Top » FontFamily= »./#Saligra » /> see : https://wpf.2000things.com/tag/embedding-fonts/

TextBlock with ellipsis at left or center

If you want a TextBlock with ellipsis a Left, Center or Right use thisyou must use TrimmedText in place of Text for binding original text [Localizability(LocalizationCategory.None, Readability = Readability.Unreadable)] public enum EllipsisPosition { // // Résumé : // Par défaut. elispsis sur la droite. Right = 0, // // Résumé : // elispsis sur la […]

Border with real ClipToBound

When we use Border, the corner radius is not used for ClipToBound see the solution with another border public class ClippingBorder : Border { protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { OnApplyClip(); base.OnRenderSizeChanged(sizeInfo); } protected void OnApplyClip() { if (this.ClipToBounds) { RectangleGeometry _clipRect = new RectangleGeometry(); _clipRect.RadiusX = _clipRect.RadiusY = Math.Max(0.0, this.CornerRadius.TopLeft – (this.BorderThickness.Left * 0.5)); […]

Retour en haut