WPF Designer Extensibility for TextBox - wpf

I want to modify the property table in VS 2010 that is associated with silverlight textbox.
I like to add a new property to the property table of a silverlight textbox without creating a custom control.
If I want to add a property called "Default value", and I want to run custom code when the user assign it from design-time property table
Can I do that?
I am reading about WPF designer extensibility, but all what I can find are for custom controls with custom properties.
Can we do it for an existing control?

No it is certainly not possible. You have to create a custom control thats the only way.

Related

"Make into Control" option in Microsoft Blend 2015

I have tried to use this Tool and I don't understand its purpose. In previous versions, it created a UserControl out of the selected controls. Now it creates a ButtonStyle for what I have seen.
How can I use this tool?
The old Blend has two options, Make Into UserControl and Make Into Control.
The Make Into UserControl wraps whatever you selected into a UserControl while the Make Into Control has always been turning whatever you selected into a Custom Control.
A Custom Control generally has a default style, and that's why you see that predefined ButtonStyle1 on the popup. A Button is a Custom Control, and that's why you can customize its look and feel by changing its style.
I'd strongly recommend you to have a read on how to create a Custom Control.

How to disable the New button in property browser of Blend?

I'm developing a custom control in WPF. This control has some properties whose type is custom class.When editting these properties in the Property Browser of Blend, there is a New button beside the editting property, While VS is not the case. My question is how to disable this New button in Blend.
Thanks in advance.
You can mark your properties with attributes that tell Blend (and Visual Studio) what to do with them. One of them is the BrowsableAttribute.
To hide the property, just add the following:
[Browsable(false)]
There are a whole lot more attributes in the System.ComponentModel namespace that you can use to customize the way properties in Blend and Visual Studio the DescriptionAttribute and CategoryAttribute.

Editing attached property in Blend and VS 2010

I defined an attached property in silverlight that I want to use it on Silverlight's TextBox
Is there a way to show this property on the property page in Blend, and VS 2010
Like we do with the attached property Grid.Column, Grid.Row, where we can set them on VS 2010?
and if yes, Can I create its own PropertyValueEditor using Silverlight extensibility?
Thanks for help
The only way that you can do this in Blend is by creating a Behavior that sets the property and creating a design-time assembly for the behavior.
Here are articles on creating a Silverlight Design-time assemblies.
Expression Blend has a file template for Behaviors - start with that and create properties that mirror each of the attached properties - call the setters/getters in those properties.

How to bind a windows control in WPF?

I'm using WPF 4.0. I have a WPF Datagrid. One of my column in a datagrid is a template column. In that template column I have used Win forms Textbox and my problem is that,
How to bind that win forms texbox control in WPF?
How to access that control or column in Code behind (c#)?
You can't use WPF data binding with WinForms controls, WPF data binding requires dependency properties and FrameworkElement derived objects - both are part of WPF and not available in WinForms.
WinForms has it's own data binding system, it's completely incompatible with WPF's data binding (it's also weaker and unusable in some cases).
If you want to use WPF's databinding you have to use only WPF controls.
I suggest you either use the WPF TextBox or switch the entire grid to WinForms and use DataGridView.
by the way - I wouldn't put a WinForms control inside a WPF data grid (or any other items control) - I suspect this will give you a lot of trouble in the future.

WPF design-time context menu

I am trying to create a custom wpf control, I'm wondering how I can add some design-time features. I've googled and can't seem to get to my goal.
So here's my simple question, how can I add an entry to the design-time context menu for my WPF usercontrol? The context menu by default has entries View Code,View XAML, etc.
You probably want to check out the WPF Designer Extensibility documentation. Specifically it sounds like you want to create a custom MenuAction.
This will help you get the context menu you require, although this applies to datagrid's still applicable;
WPF DataGrid Design-time Walkthrough

Resources