question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some control properties are not updated in real time as they are set? Version: 0.10.0-preview5

See original GitHub issue

I just have cloned Slider -> SliderEx just to expose thumb with public getter, don’t know if i can get it by code but:

<uc:SliderEx
          Grid.Column="2"
          Name="Layer.Navigation.Slider"
          Minimum="0"
          Maximum="{Binding SliderMaximumValue}"
          Ticks="{Binding SliderMaximumValue}"
          Value="{Binding ActualLayer}"
          TickFrequency="1"
          TickPlacement="Outside"
          SmallChange="1"
          LargeChange="10"
          IsSnapToTickEnabled="True"
          Margin="0,5,0,5"
          HorizontalAlignment="Right"
          Orientation="Vertical"/>

public uint ActualLayer
        {
            get => _actualLayer;
            set
            {
                if (!SetProperty(ref _actualLayer, value)) return;
                OnPropertyChanged(nameof(CanGoDown));
                OnPropertyChanged(nameof(CanGoUp));
                OnPropertyChanged(nameof(ActualLayerTooltip));
                OnPropertyChanged(nameof(LayerNavigationTooltipMargin));
                OnPropertyChanged(nameof(LayerPixelCountStr));
                OnPropertyChanged(nameof(LayerBoundsStr));
                ShowLayer();
            }
        }

        public Thickness LayerNavigationTooltipMargin
        {
            get
            {
                double top = 0;
                if (LayerSlider?.Track != null)
                {
                    double trackerPos = LayerSlider.Track.Thumb.Bounds.Height / 2 + LayerSlider.Track.Thumb.Bounds.Top;
                    double halfTooltipHeight = LayerNavigationTooltipBorder.Bounds.Height / 2;
                    top = (trackerPos - halfTooltipHeight).Clamp(0,
                        LayerSlider.Bounds.Height - LayerNavigationTooltipBorder.Bounds.Height);
                    
                }
                return new Thickness(
                    0,
                    top,
                    5,
                    0);
            }
        }

Video of effect: https://youtu.be/4fbsOdm_SF4

Things i tried without success:

LayerSlider.InvalidateArrange();
LayerSlider.Track.InvalidateArrange();
LayerSlider.Track.Thumb.InvalidateArrange();
// Subscribe slider Value propertychanged and call OnPropertyChanged(nameof(LayerNavigationTooltipMargin));

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (16 by maintainers)

github_iconTop GitHub Comments

1reaction
rstm-sfcommented, Sep 27, 2020

I’m new to WPF/Avalonia i come from WinForms, that’s why this is strange to me

@sn4k3 you can go through this tutorial without using reactiveui. Also you can look at this answer and this project. MVP and MVVM are friends with each other, so there is an MVPVM approach and it is very good for winforms

0reactions
timuniecommented, Mar 16, 2023

The need to use Dispatcher.UIThread seems to be required if property update are under override of Render method, while in others, for example in a button callback, that is not required.

Yeah, I think Render has it’s own thread in 11.0, so it’s expected that the event must be redirected to the UIThread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

User Control DependencyProperties not updating because ...
And the Setting class throws the PropertyChanged event when its value changes. The viewModel has a SelectedDevice property and its set as ...
Read more >
Controls properties not updating (from UpdateContext variable ...
I am having problems with Controls properties (Titles, Dropdowns, Galleries, ...) not updating when a record with large amount of data is ...
Read more >
Changelog | XR Interaction Toolkit | 2.0.4
These settings are stored within a new Assets/XRI folder by default. Added a Select Mode property to Interactables that controls the number of...
Read more >
Solved: how to change properties for some controls in runtime
Problem I have I don't know which reference to connect to property node in case the control in for loop is not a...
Read more >
UIControl Properties
The uicontrol function creates a user interface control and sets any required properties before displaying it. By changing property values, you can modify ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found