I'd personally use a scale transform rather than star values.  It would
allow you to bind the ScaleY property to a view model property with the
value to display however, so no need for code-behind.

Chris


On 2 July 2010 08:38, Xerxes Battiwalla <[email protected]> wrote:

> Hi everyone,
>
> This week we've needed to create a gauge control which is used to indicate
> positive values by filling a bar from the middle of the gauge upward, and
> negative values from the middle downward. A picture is worth a thousand
> words, so here's a QnD of what the control should do:
> http://www.xerxesb.com/wp-content/uploads/2010/07/gauges.png
>
> The first gauge shows the control in its initial state. When the user
> presses the up arrow, the control increases in single increments (as in the
> second gauge) and when they press down it goes in reverse (third gauge)
>
> We managed to do it, but I wanted to canvas how everyone else would
> implement the same control?
>
> Our implementation basically used a fill for the green bit, and placed it
> inside a grid with two rows (the grid was only half the size of the whole
> bar, and by default positioned to the entire height of the positive side of
> the gauge). The fill's size was set to take up the entire bottom row, and we
> then had some code in the code-behind to set the size of both rows using
> star values. If the value was negative we then apply a RenderTransform to
> flip the fill upside down. It works, but feels kludgy. Was hoping there is a
> XAML only way of doing something like this?
>
> Cheers,
> Xerx
>
> _______________________________________________
> ozwpf mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf
>
>
_______________________________________________
ozwpf mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozwpf

Reply via email to