We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Can't adjust thickness

I'm trying to create a progress bar to show the progress of a file upload. I've got it working nicely but I can't seem to adjust the thickness of the progress bar.
It seems like when I add Thickness="10" or even Thickness="20" that the thickness of the bar doesn't actually change. I also add Padding="2" or Padding="10" and instead of increasing the bar's thickness, it just seems to push the actual progress bar off the screen so that only the track is visible (still at incorrect thickness).


This is my code:

<StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" Padding="0,10,20,10" VerticalOptions="CenterAndExpand">
<Label IsVisible="{Binding UploadInProgress}" Text="Uploading file..." VerticalOptions="Center" LineBreakMode="NoWrap" />
<progressBar:SfLinearProgressBar Progress="{Binding AttachProgress}" TrackColor="DarkGray" ProgressColor="DeepSkyBlue" 
VerticalOptions="Center" HorizontalOptions="FillAndExpand" 
Minimum="0" Maximum="1" CornerRadius="15">
<progressBar:SfLinearProgressBar.RangeColors>
<progressBar:RangeColorCollection>
<progressBar:RangeColor IsGradient="True" Color="#337ab7" Start="0" End="0.5"/>
<progressBar:RangeColor IsGradient="True" Color="DeepSkyBlue" Start="0.5" End="1"/>
</progressBar:RangeColorCollection>
</progressBar:SfLinearProgressBar.RangeColors>
</progressBar:SfLinearProgressBar>
</StackLayout>

4 Replies

DB Dilli Babu Nandha Gopal Syncfusion Team July 8, 2019 05:45 AM UTC

Hi Alex, 
 
Thank you for contacting Syncfusion support. 
 
Yes, it is possible to set the height of progress bar by using “TrackHeight” property.  Please refer the following documentation link which illustrates how to set the height of progress bar. 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Dilli babu. 



AL Alex replied to Dilli Babu Nandha Gopal July 8, 2019 05:08 PM UTC

Hi Alex, 
 
Thank you for contacting Syncfusion support. 
 
Yes, it is possible to set the height of progress bar by using “TrackHeight” property.  Please refer the following documentation link which illustrates how to set the height of progress bar. 
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Dilli babu. 


Dilli,

This does not work at all. I have attached a sample project showing it not working.



Attachment: ProgressBarTest_47ad986a.zip


AL Alex July 8, 2019 05:25 PM UTC

What I am finding is:
  • If you set TrackHeight="10" and Padding="2", the progress bar will show the progress at the incorrect position.
  • If you set TrackHeight="10" and Padding="0", the progress bar will show at the correct position, but the height of the bar will not actually change.
I believe the documentation is misleading because what it seems you actually need to do is set both TrackHeight and HeightRequest to the same value.
If you say TrackHeight="10" and HeightRequest="10", you will see the desired result. The documentation states that you need to use TrackHeight and Padding together, when it should probably say HeightRequest instead of Padding, since padding does not directly effect the actual height of the track.

I would also like to suggest that the code is changed to make TrackHeight affect HeightRequest automatically somehow so that you don't need to set both. That would be a lot more understandable for people trying to make a larger progress bar. Then the last thing to fix is how setting a Padding value without HeightRequest messes up the progress bar's position.


DS Devaraj Sekar Syncfusion Team July 9, 2019 12:08 PM UTC

Hi Alex, 
 
Thank you for the update. 
 
We are able to reproduce the reported problem at our end which seems to Xamarin Layout behavior. We need to set Layout Options according to the Stack Layout Orientation to allocate spacing for the individual view getting added in the Stack Layout, which is stated in the below MSDN link. 
 
 
 
 
We have modified the provided sample to achieve the mentioned requirement which is available in the following link. 
 
Sample Screenshot: 
 
 
So, when a Track Height of SfLinearProgressBar inside Stack Layout need to be increased then LayoutOptions must be FillAndExpand or height request need to be set which is a Xamarin Forms behaviors. Kindly let us know if you require any further assistance.  
 
Regards, 
Devaraj S 


Loader.
Live Chat Icon For mobile
Up arrow icon