Converter/Markup with parameter

if you want a converter/markup and using constructor and parameter

this is a converter/markup for divid value received by parameter

and usage

and set line at the center of the control (grid)

Categories: Non classé Tags:

Window system menu on image

If you have an image replacing standard icon for window you can show window system menu by using

like this

Categories: Non classé Tags:

Simple ScrollViewer With Offset in DP

if you want a ScollWiever with offsets use

and you can animate then with

and for sample

 

Categories: Non classé Tags:

Clipping a control from another control (with binding)

If you want to clip a control form another control you can use this markup (showed only in run)

and usage

also, you can specify your own geometry from FrameworkElement by override class Geometry and override GetGeometry(…)

Categories: Non classé Tags:

EnumExtension with contains

For simplify flag enum usage

use this code

and usage

Categories: Non classé Tags:

ToolTips with StringFormat when it’s don’t work

If you want bind a tooltip with value and have a StringFormat of a slider for exemple… the StringFormat is not apply (for tag or another property it’s the same behavior)
For solve it use this code

tag is set for see result

Categories: Non classé Tags:

ToolTip on moving thumb for slider

I try to find a solution for having in slider a tooltip moving under thumb when i drag it

after reading somes post like :https://stackoverflow.com/questions/1178134/wpf-adding-a-tooltip-to-the-track-of-a-slider
i think that restyle slider is not a good solution when you using already restyled slider as mahapp for example
and microsoft good explain for tooltip position : https://docs.microsoft.com/fr-fr/dotnet/framework/wpf/controls/how-to-position-a-tooltip

So i find a better solution (more simple) with an attached property

and using like this

we can find many improvment about this helper, but this is the first draft

Categories: Non classé Tags:

Draw lines at real pixel position

If you want to draw lines in OnRender function for sample, you have a antialiasing and you can’t have a real position (at pixel)

with this code (find in https://stackoverflow.com/questions/6018106/wpf-drawingcontext-seems-ignore-snaptodevicepixels) you can solve it

and code sample

 

 

Categories: Non classé Tags:

Converter is a Markup

If you want simplify your code it’s better to make a converter who is also a markup

Previous code for converter

Previous code for xaml

And new code for converter

and xaml 

see the difference

Categories: Non classé Tags:

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: