Processing
 

progress bar on windows 7 WPF

08/09/2016 07:29#1

Joined at: 8 months ago

Post: 4

Thank: 0

Thanked: 0

Hello I am working on WPF application, I've used a progress bar to show the progress of a download. Here is my code:

<ProgressBar x:Name="DownloadProgress" Value="100" Maximum="100" Margin="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Foreground="#FF222222" Background="Transparent" FlowDirection="RightToLeft" BorderThickness="0"/> 

The progress bar is designed such that it looks like its uncovering something hence the progress value starts with 100 ends at 0. The issue is on a windows 10 machine it works exactly as its supposed to look like this:progress bar on windows 7 WPF But on a windows 7 machine it looks like this: progress bar on windows 7 WPF which is horrible. Can anyone help me finding out why does the progressbar looks like that on windows 7 when it looks perfect to design on windows 10

08/09/2016 09:36Top#2

Joined at: 4 months ago

Post: 1

Thank: 0

Thanked: 0

You need to set up style in your progress bar. What actually happens is, the WPF application by default loads up the theme for you application based on the OS. So while you're setting the foreground property the

<Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left">                             <Rectangle x:Name="Indicator" Fill="{TemplateBinding Foreground}"/>                             <Rectangle x:Name="Animation" Fill="{TemplateBinding Foreground}" RenderTransformOrigin="0.5,0.5">                                 <Rectangle.RenderTransform>                                     <TransformGroup>                                         <ScaleTransform/>                                         <SkewTransform/>                                         <RotateTransform/>                                         <TranslateTransform/>                                     </TransformGroup>                                 </Rectangle.RenderTransform>                             </Rectangle>                         </Grid> 

Rectangle named indicator leads up the template Fill which gives you this repulsive color change that to your preferred color and that should do the trick. So your updated code would be:

<Grid x:Name="PART_Indicator" ClipToBounds="true" HorizontalAlignment="Left">                             <Rectangle x:Name="Indicator" Fill="#FF222222"/>                             <Rectangle x:Name="Animation" Fill="#FF222222" RenderTransformOrigin="0.5,0.5">                                 <Rectangle.RenderTransform>                                     <TransformGroup>                                         <ScaleTransform/>                                         <SkewTransform/>                                         <RotateTransform/>                                         <TranslateTransform/>                                     </TransformGroup>                                 </Rectangle.RenderTransform>                             </Rectangle>                         </Grid> 
Similar articles

How to use Logstash with log4j in Windows 7 32-bit VM

4 months ago - Reply: 1 - Views: 116

Running webrick server in background for Windows

4 months ago - Reply: 0 - Views: 40

Task Scheduler doesn't start my exe for the next day

4 months ago - Reply: 0 - Views: 32

Unable to get Windows Updates in Windows 7 [on hold]

4 months ago - Reply: 0 - Views: 21

Connect Spark-Shell using Eclipse in Windows 7

4 months ago - Reply: 0 - Views: 21

Can't use custom windows themes

4 months ago - Reply: 1 - Views: 108

“npm install <module>” doesn't work

4 months ago - Reply: 0 - Views: 31

OpenGL 4.5 functions segfaulting

4 months ago - Reply: 0 - Views: 6

Executing a batch file during installation

4 months ago - Reply: 0 - Views: 2

vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re vé máy bay vé máy bay giá rẻ ve may bay ve may bay gia re