C
C#

WPF ScrollViewer issues

WPF ScrollViewer issues

FFabiCrafter11/19/2023
Hello, I have the problem that the scrollviewer in C# (WPF) does not work properly. I haven't defined anything special, but the scrollviewer runs from bottom to top, i.e. with the content, which is exactly the opposite direction. I would be very grateful if someone could help me. My code:
<ScrollViewer VerticalScrollBarVisibility="Visible" Margin="10,10,10,10">
<ScrollViewer.Resources>
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Foreground" Value="DarkGray"/>
<Setter Property="Width" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid>
<Track x:Name="PART_Track" Width="10">
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="{x:Type Thumb}">
<Rectangle Fill="{TemplateBinding Background}" RadiusX="5" RadiusY="5"/>
</ControlTemplate>
</Thumb.Template>
<Thumb.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="DarkGray" Offset="0.0"/>
<GradientStop Color="Gray" Offset="0.5"/>
<GradientStop Color="DarkGray" Offset="1.0"/>
</LinearGradientBrush>
</Thumb.Background>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ScrollViewer.Resources>
<ScrollViewer VerticalScrollBarVisibility="Visible" Margin="10,10,10,10">
<ScrollViewer.Resources>
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Stylus.IsFlicksEnabled" Value="false"/>
<Setter Property="Foreground" Value="DarkGray"/>
<Setter Property="Width" Value="20"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ScrollBar}">
<Grid>
<Track x:Name="PART_Track" Width="10">
<Track.Thumb>
<Thumb>
<Thumb.Template>
<ControlTemplate TargetType="{x:Type Thumb}">
<Rectangle Fill="{TemplateBinding Background}" RadiusX="5" RadiusY="5"/>
</ControlTemplate>
</Thumb.Template>
<Thumb.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Color="DarkGray" Offset="0.0"/>
<GradientStop Color="Gray" Offset="0.5"/>
<GradientStop Color="DarkGray" Offset="1.0"/>
</LinearGradientBrush>
</Thumb.Background>
</Thumb>
</Track.Thumb>
</Track>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ScrollViewer.Resources>
FFabiCrafter11/19/2023
No description
No description
No description
DDharmang11/19/2023
I think @Mimal99 can help you with that 😉 ...
FFabiCrafter11/19/2023
Thanks, let's see what he's saying 🙂
DDharmang11/19/2023
Can you share the whole sample code?
FFabiCrafter11/19/2023
Sure, one moment
FFabiCrafter11/19/2023
It's just XAML code for the design, I'll add the C# code and all functions later
FFabiCrafter11/19/2023
Or do you need more?
DDharmang11/19/2023
no just need this
FFabiCrafter11/19/2023
alright
DDharmang11/19/2023
@FabiCrafter it seems the issue is with the custom scrollbar template
FFabiCrafter11/19/2023
Okay, do you have any idea how to fix it? I have no clue why this happened
DDharmang11/19/2023
... 😄 i just know dotnet web api's but when i commented out that code it is working as expected. maybe try getting the code from chatgpt. i am doing that rn
FFabiCrafter11/19/2023
I've just tried that, but unfortunately ChatGPT 3.5 doesn't seem to have a solution for my problem
DDharmang11/19/2023
i am not much experienced with wpf but try this out. chatpgpt is giving half-a$$ results https://github.com/CSharpDesignPro/WPF-Custom-Scrollbar/blob/master/Source/MainWindow.xaml
FFabiCrafter11/19/2023
Adding IsDirectionReversed="True" to my Track attribute fixed the issue. Thanks guys.
DDharmang11/19/2023
when i pasted i was getting errors.. and didnt know how to solve it lol

Looking for more? Join the community!

C
C#

WPF ScrollViewer issues

Join Server
Want results from more Discord servers?
Add your server
Recommended Posts
✅ Quick - Unity "using" directiveReally quick question guys, when trying to use methods from other scripts in Unity, let's say the ot✅ .Split() Returning Spaces Between Words in String[]Hi. I have an string array `string[] strArr` of words in format `[word1, word2]` and so on - just a I want to compile a program myself with less filesI was working on a open source project, and I want to compile the program myself so I setup a github✅ Finding Processes but it displays as invisibleSo I am making a system monitor, and I ran into a problem where when I click the button to display t✅ Getting artifact from GitHub Repo ends in SSL_ERROR_SSLHello guys, working on a console app to more or less download artifacts from our private GitHub Repo✅ DB ErrorHey guys, I am working on a project and I am trying to connect it to a DB. I am following the instruCalculate Field Offset Based On Members' NameI'd like to know if the offset calculation is correct. the input used is as follows```cs private coFollowing a video to create power ups, but its not picking them up and I dont know why.Heres the code. I dont know whats wrong with it, from what I can tell its exactly the same as the vConverting int to double to output with decimalsHello again! i got a little problem with converting int to double, i dont get it to output the decimDb ConnectionGood afternoon guys, I need some help setting up the database connection for my project. I have thCan't read property in code behind```cs @page "/weather" @attribute [StreamRendering] <PageTitle>Weather</PageTitle> <h1>Weather</h1RabbitMQ starting service issuePlease guys I had `RabbitMQ` running fine, but after restarting my computer the RabbitMQ won't be stException Unhandled : Could not load file or assembly 'Serilog.Extensions.HostingWhen I run my application, this exception is thrown even before the start of debugging. System.IO.Figot this code that i wrote the get all score and print end score but i didnt read right help meexem is 40% assigments is 30% and participation is 30%Assistance regarding deciding on what to use.Hello there, I want to port one of my macOS apps to a native windows app and would like to ask which✅ C# SMS/MMS BotI have a project I'm working on I have a working PBX that receives SMS and MMS messages to a web conHelp deciding Next.js/Node.js vs .NET API back-endHello. I really want to use .NET as my API back-end for a practice app I'm building. However, I dohow do i make it so when i press it this happens and if i do it again another thing happensive made a code in winforms so when i press with my left mouse button it hides everything, how do i Can't access object attributes using X.PagedListI have a search field that returns a list of movies. It works fine if I reference the model as @MoviTryin to install scriptscs but cinst is not a recognized commandI'm trying to install scriptcs but cinst isn't a recognized command. I have uninstalled and reinstal