2021年1月17日星期日

How to use DoubleToVisibilityConverter in uwp

DoubleToVisibilityConverter can be used to easily change a double value to a Visibility based one based on a given threshold value. If both GreaterThan and LessThan are set, the converter will set the visibility if the target value is in-between those two values. Otherwise, it will look for the target being greater than or less than the specified value.

so my question is ----

How to use DoubleToVisibilityConverter for scrollviewer as i want to hide (back to Top)Button and scrollbar is at last down position and when scrollbar is going to up it will show the button.

i am using back to top button for scroll to top.

[ same as working in many website (scrollUp Button) ]

Below one is MainPage.xaml

XAML - Page Resource

<Page.Resources>     <converters:DoubleToVisibilityConverter x:Key="GreaterThanToleranceVisibilityConverter" GreaterThan="65.0"/>  </Page.Resources>  

XAML - Ui Element

<Button x:name="Scroll_To_Up_Button" Visibility="{Binding ScrollableHeight, Converter{StaticResourceGreaterThanToleranceVisibilityConverter}/>  

where i have to add

ScrollableHeight

in MainPage.xaml.cs and how to use in MyUWP App.

https://stackoverflow.com/questions/65752696/how-to-use-doubletovisibilityconverter-in-uwp January 17, 2021 at 01:44AM

没有评论:

发表评论