You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have implemented a Ribbon inside a RibbonWindow. I am using a view model to dynamically change the window icon based on some input. It seems that binding the Icon property doesn't work. The icon which is set on the binding source (the view model) isn't taken over by the RibbonWindow. It remains empty.
Probably this is an issue with an early evaluation of the value and internal setting the then-selected ImageSource on the PART_Icon part.
Environment
Fluent.Ribbon 6.0.0.208
Windows 10 version 1709 build 16299.192
.NET Framework 4.7.1
Code
XAML:
Icon="{Binding ApplicationIcon}"
this.DataContext is set through the window constructor to a model defining ApplicationIcon. Having the exact same binding on a regular Window does work.
Workaround
I currently have a workaround where I manually set a binding on the PART_Icon through the OnApplyTemplate (in a derived class, so it keeps the current default working of RibbonWindow.OnApplyTemplate):
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
const string PART_Icon = "PART_Icon";
Image iconImage = this.GetTemplateChild(PART_Icon) as Image;
if (iconImage != null)
{
Binding myBinding = new Binding();
myBinding.Source = this;
myBinding.Path = new PropertyPath(nameof(Icon));
myBinding.Mode = BindingMode.TwoWay;
myBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
BindingOperations.SetBinding(iconImage, Image.SourceProperty, myBinding);
}
}
The text was updated successfully, but these errors were encountered:
I have implemented a Ribbon inside a
RibbonWindow
. I am using a view model to dynamically change the window icon based on some input. It seems that binding theIcon
property doesn't work. The icon which is set on the binding source (the view model) isn't taken over by theRibbonWindow
. It remains empty.Probably this is an issue with an early evaluation of the value and internal setting the then-selected
ImageSource
on thePART_Icon
part.Environment
Code
XAML:
this.DataContext
is set through the window constructor to a model definingApplicationIcon
. Having the exact same binding on a regularWindow
does work.Workaround
I currently have a workaround where I manually set a binding on the
PART_Icon
through theOnApplyTemplate
(in a derived class, so it keeps the current default working ofRibbonWindow.OnApplyTemplate
):The text was updated successfully, but these errors were encountered: