Apply stroke to a textblock

find on https://stackoverflow.com/questions/93650/apply-stroke-to-a-textblock-in-wpf

and use with

 

Categories: Non classé Tags:

ProgressBar with percent text

If you want a progress bar with text two colors you can use this

and style in generic.xaml

result for

code

 

Categories: Non classé Tags:

VisualBrushExtension for convert canvas to visual brush (and allow binding)

if you want to use a canvas for visualbrush
like this

for

you can use this code (define as markup)

this markup allow tu use binding too

 

Categories: Non classé Tags:

DoubleAnimation with Step

For having step working in double animation use

like this (for rotation)

 

Categories: Non classé Tags:

Adding font in wpf application

For using a font in resource

sample

see : https://wpf.2000things.com/tag/embedding-fonts/

Categories: Non classé Tags:

TextBlock with ellipsis at left or center

If you want a TextBlock with ellipsis a Left, Center or Right use this
you must use TrimmedText in place of Text for binding original text

and use like this

see result

   

Categories: Non classé Tags:

Border with real ClipToBound

When we use Border, the corner radius is not used for ClipToBound
see the solution with another border

 

Categories: wpf Tags: ,

AddRange for ObservableCollection

An extension methode for addinf AddRange to ObservableCollection<T>

 

Categories: Non classé Tags:

UniformGrid with two orientations

for many applications we need to have an  uniform grid with

  • Orientation (horizontal or vertical)
  • VericalOriention (top or bottom) for positionning first element
  • and finaly can use  FlowDirection (LegftToRight or Right to left)

with this code

see somes samples pictures

you can test with this code

and xaml

 

 

 

Categories: Non classé Tags:

Control for menu Item collection

A simple CustomControl for using collection in MenuItem with another MenuItem

from article : https://www.codeproject.com/Articles/22834/MenuItems-Collections-within-a-MenuItem

opriginal source code : MenuItems_Src

CustomControl

and style in generic.xaml

for using

with in MVVM

 

Categories: Non classé Tags: