Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent.Button Header Binding not visible #961

Closed
PJonHar opened this issue Jul 9, 2021 · 8 comments
Closed

Fluent.Button Header Binding not visible #961

PJonHar opened this issue Jul 9, 2021 · 8 comments
Assignees
Labels
Milestone

Comments

@PJonHar
Copy link

PJonHar commented Jul 9, 2021

I have added a binding to the header property of a fluent.button, however when the application is running the value is not seen?
I have used snoop and i can see that the binding is happy and with the correct value but it does not show?

the value 100 should be showing in the button header.

any ideas?

image

<Fluent:Button Command="{Binding ProgramSpeedCommand}" Header="{Binding ApplicationRobotControl.Robot.ProgramSpeed, FallbackValue=0}" Icon="pack://application:,,,/KUKA.RGI v3;component/Icons/hand.ico" LargeIcon="pack://application:,,,/KUKA.RGI v3;component/Icons/hand.ico"> <Fluent:Button.ToolTip> <Fluent:ScreenTip Title="Program Speed" Width="250" DisableReason="This control is disabled to show 'disable reason' section" HelpTopic="Help for Orange ScreenTip" Image="pack://application:,,,/KUKA.RGI v3;component/Images/hand.png" Text="This control is disabled and has fixed width 250px" /> </Fluent:Button.ToolTip> </Fluent:Button>

@batzen
Copy link
Member

batzen commented Jul 9, 2021

Could you remove the FallbackValue and try it again?
I have seen very strange behavior of bindings in combination with fallback values recently.

@PJonHar
Copy link
Author

PJonHar commented Jul 12, 2021

I have tried removing the FallbackValue but the value doesnt show on the ribbon button.

@batzen
Copy link
Member

batzen commented Jul 12, 2021

Could you share a repro?

@PJonHar
Copy link
Author

PJonHar commented Jul 13, 2021

Sure, see attached.
image

FluentRepro.zip

@batzen batzen self-assigned this Jul 13, 2021
@batzen batzen added this to the 9.0 milestone Jul 13, 2021
@batzen
Copy link
Member

batzen commented Jul 13, 2021

That's quite strange.
Most controls in Fluent.Ribbon use a TemplateBinding for the header, which does not seem to work when the bound value is not a string.
It works again if using a Binding with a relative source...

@PJonHar
Copy link
Author

PJonHar commented Jul 13, 2021

If possible could you show me a workaround please?

@batzen batzen closed this as completed in b50ff6e Jul 13, 2021
@batzen
Copy link
Member

batzen commented Jul 13, 2021

A workaround for you would be:

        public string ProgramSpeedString { get => programSpeed.ToString(); }
        public int ProgramSpeed { get => programSpeed; set { programSpeed = value; NotifyPropertyChanged(nameof(ProgramSpeed)); NotifyPropertyChanged(nameof(ProgramSpeedString)); } }

And then bind to ProgramSpeedString instead of ProgramSpeed.

@PJonHar
Copy link
Author

PJonHar commented Jul 15, 2021

Thanks.
I ended up using a converter to return the ToString() of an object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants