Blend/VS designer support for adding complex content based on boolean property - xaml

I have my own derived WPF DataVisualization chart control and within that control, I have a boolean property that the designer can set which in turn creates and adds a line series to that chart control.
Now the problem is that I can easily create the line series object within the chart when the designer sets that property, but I also need to insert a complex xaml segment into the .xaml file associated with that newly created line series. Is there a way to automatically insert that xaml code into the xaml file when that boolean property is set in the blend designer?
Thanks
Leo

By default, the only properties you can expose are individual attributes on existing elements. There is no provision to insert new elements based on attribute changes. You only add elements by inserting new controls etc.
Create an extension for Expression Blend:
To do what you want you would need to create a plugin for Expression Blend. If you are in a position to do that then anything is possible (add entirely new tools and properties for instance):
Try this link for starters

Related

Localizing a user control with inheritance at runtime VB.net

I have a UserControl which Inherits Listiview and I am tying to figure out how to localize the column headers.
I have looked at Localization at runtime, but it's not getting me where I need to go.
I create my inherited listviews at runtime, so I somewhow need to iterate the column collection and apply the appropriate localization.
Prior to the Form Intialize, I use Thread.CurrentThread.CurrentUICulture = New CultureInfo(sLang) and this works successfully on all the form's static controls in changing all the text, but not on my dynamically added listviews' columns.
???
Thanks

How can I derive a control to an inherited form in VB.Net?

everybody.
I have a VB form (named "MyBaseForm"), with an ImageList control ("MyIcons").
I want to derive MyBaseForm to another form ("MyDerivedForm"), allowing it to use MyIcons ImageList defined into the base class.
Of course what I want to do is to use the images of MyIcons to define MyDerivedForm with Designer and/or into the code.
To do that, i set MyBaseForm.MyIcons.Modifiers property to Protected (I also tried with Public and Protected Friend, with the same results...)
In this way, I expect that if i modify the MyIcons image list from the Designer view of MyBaseForm, I would find the change into MyDerivedForm.
But, if i for example add a new image to MyBaseForm.MyIcons, MyDerivedForm.MyIcons keeps being still unchanged.
It looks like when i create the derived form, VisualStudio just create a copy of the ImageList control. Which is not what i want.
To have MyDerivedForm.MyIcons updated, what I have to do is to manually remove the "MyIcons" section of file MyDerivedForm.Designer.vb, so that, when I re-build, VisualStudio re-generates that section.
Is there a way to have that control REALLY derived, or, alternatively, to force the compiler to re-create MyDerivedForm.Designer.vb at any build (without having to manually manipulate the self-generated code)?
(I am using VB.Net 2005)

How can I remove all properties of a user control?

I am working on a Visual Basic project and I had to create my own user control. I want to remove-hide ALL default properties of this user control but not by using this <Browsable(False), EditorBrowsable(EditorBrowsableState.Never)> way, one by one property. I need something more massive.
I'm afraid what you want to do isn't possible in VB, as it would require to add the attributes dynamically (on all properties) and in VB attributes are static and cannot be added or removed dynamically.
The only way to do what you want to do is to add the attributes one by one property.

Custom Control with Multiple ContentPresenters

I am trying to implement a custom control which will show different content according to 3 different control states. I've achieved this by adding a state, and 3 different content properties to my control.
What I have now is something like that.
User sets CurrentState property to one of, "Default", "CurrentStep" or "Completed".
Control switches to a different visual state via VisualStateManager.
Controls default template sets Visibility property on 3 different ContentPresenters to display single content.
It's all working with no problem. What I am struggling to do is enabling design time support. The only thing I can do is to set ContentProperty attribute to one of the content properties, so that Blend shows this property as a child in it's control tree. However this enables only one content property to be editable in design time.
What more can I do to add design time support to my control?
I would not have created a custom control with multiple contentPresenter.
To achieve what you are trying to do, most of the time, you create a control with named parts (the default winrt control templates use this "named parts" mechanism).
When your custom control state changes, you simply show/hide one or more named parts.
This way your can provide a default control template, with all the named parts you require, and to customize the control, you override the default template, and define your own parts. The show/hide logic depending on the states will remain the same, but the target control choice is up to the guy writing the template.

How to add a tab in the color palette

Hello
I am working in VB.Net 2.0 windows forms.
A color palette occurs on click of backcolor of any control. I want to add a new tab in this palette. In the new tab, I want to add the new colors as per the requirement.
The actual dialog is a private class named ColorUI, nested inside the System.Drawing.Design.ColorEditor class. That prevents you from altering it.
You'll need to create a complete replacement for this UITypeEditor derived class. You can get implementation hints on getting this right by using Reflector. Beware that you cannot override the [Editor] attribute on existing controls, your new version of the dialog will only be usable on your own custom controls.