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.
Last Visit: 31-Dec-99 19:00 Last Update: 4-Mar-21 9:38