In my utility WPF library I (reinvented the wheel, yeah yeah, I know..) created a Behaviors attached property of type BehaviorList.
static DependencyPropertyKey BehaviorsKey = DependencyProperty.RegisterAttachedReadOnly(
"PrivateBehaviors", // REMARK: name is different from property to force GetBehaviors() calltypeof(BehaviorList),
publicstatic DependencyProperty BehaviorsProperty = BehaviorsKey.DependencyProperty;
publicstatic BehaviorList GetBehaviors(DependencyObject target)
var result = (BehaviorList)target.GetValue(BehaviorsProperty);
if (result == null)
result = new BehaviorList(target);
then I used this property in XAML to add my own custome behavior type:
This works well and good (at runtime) but the designer has red underlines and show the following errors:
Error XLS0503, A value of type 'DragLayerGroupBehavior' cannot be added to a collection or dictionary of type 'BehaviorList'.
Error XDG0048, The specified value cannot be assigned to the collection. The following type was expected: "Behavior".
So the question is, how to "solve" those errors, i.e. unconfused VisualStudio WPF designer?
Is there a particular interface I need to implement, some attribute to use, or something?
I have four controls in a horizontal row.
The first and third control shouöd automatically resize and fill the available space when resizing the MainWindow. The second and forth controls have a static width and I don't want them to change horizontally in size. All four controls should fill vertically.
I have almost solved it with an UniformGrid as container for the four controls.
The columns in a UniformGrid will always be the same width. Since you have four columns, each column will be ¼ of the width of the window. The controls with a defined width are aligned in the centre of the column, which is why you're getting white-space around them.
The obvious option would be to use a standard Grid. This would require adding column definitions, and setting the Grid.Column attached property on each child control.
There are two different functions here. The idea here is similar to Office's Add To Quick Access Toolbar feature. it allows the user to see what content is displayed in the Quick Actions list on their Home tab.
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
I know I am a little late to the party, haven't been visiting as much as I used to. However, I wasn't sure if you ever fixed your problem.
If I understand what your original question was, it would be that as you were on the treeviewitem the link would show but as soon as you moved to click on the link, the link would disappear.
I have created something similar in a project of mine. I think your trigger is set up correctly, however, I think it is your actual template that might be causing the problem.
I created a Grid much like yours, but instead of breaking it down in to columns I used a stack panel and set the orientation to horizontal. I think this makes the entire item one control instead of seeing two different entities inside of a grid. This allows for me to scroll over to my buttons without losing the trigger of the IsMouseOver.
As I pointed out we have set up the trigger the same, but my TreeviewItem.ItemTemplate was a little different than yours and this seems to work for me nicely. Hope it helps! Again, I know I'm a month late, but if this didn't help you, maybe it helps someone. Cheers.
Last Visit: 22-Oct-19 17:37 Last Update: 22-Oct-19 17:37