Click here to Skip to main content
16,012,110 members
Home / Discussions / WPF
   

WPF

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:09
cofounderChris Maunder16-Jul-09 3:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 3:05
cofounderChris Maunder16-Jul-09 3:05 
QuestionApp WPF Pin
Nelson196526-Sep-24 15:39
Nelson196526-Sep-24 15:39 
QuestionRenderTransform Compilation Error Pin
Kevin Marois16-Sep-24 7:15
professionalKevin Marois16-Sep-24 7:15 
AnswerRe: RenderTransform Compilation Error Pin
#realJSOP26-Sep-24 0:53
professional#realJSOP26-Sep-24 0:53 
Question"Refresh" Behavior Pin
Kevin Marois19-Aug-24 11:20
professionalKevin Marois19-Aug-24 11:20 
AnswerRe: "Refresh" Behavior Pin
#realJSOP12-Sep-24 4:10
professional#realJSOP12-Sep-24 4:10 
GeneralRe: "Refresh" Behavior Pin
Kevin Marois16-Sep-24 7:22
professionalKevin Marois16-Sep-24 7:22 
GeneralRe: "Refresh" Behavior Pin
#realJSOP26-Sep-24 0:54
professional#realJSOP26-Sep-24 0:54 
Questionbinding textblock to tabitem textblocks Pin
geomeo12329-Jul-24 17:00
geomeo12329-Jul-24 17:00 
Question[WPF] ComboBox with RichTextBox Pin
Member 846740328-Jul-24 6:36
Member 846740328-Jul-24 6:36 
AnswerRe: [WPF] ComboBox with RichTextBox Pin
Member 846740328-Jul-24 6:44
Member 846740328-Jul-24 6:44 
QuestionHow to create and save High Score in my Tetris game in wpf c#? Pin
Member 162860911-Jul-24 1:03
Member 162860911-Jul-24 1:03 
AnswerRe: How to create and save High Score in my Tetris game in wpf c#? Pin
Richard MacCutchan1-Jul-24 1:20
mveRichard MacCutchan1-Jul-24 1:20 
Questionselect text box lines and remove Pin
geomeo12322-Jun-24 16:30
geomeo12322-Jun-24 16:30 
AnswerRe: select text box lines and remove Pin
Richard Deeming23-Jun-24 21:47
mveRichard Deeming23-Jun-24 21:47 
GeneralRe: select text box lines and remove Pin
geomeo12324-Jun-24 7:52
geomeo12324-Jun-24 7:52 
QuestionCustom Control Based On Combobox - Replace Part Of The Combobox Pin
Kevin Marois14-Jun-24 18:27
professionalKevin Marois14-Jun-24 18:27 
AnswerRe: Custom Control Based On Combobox - Replace Part Of The Combobox Pin
Dave Kreskowiak15-Jun-24 5:48
mveDave Kreskowiak15-Jun-24 5:48 
I seriously recommend picking up a book on WPF. This kind of stuff is covered in them.

Yes, you can replace just about anything you want in a WPF control. You just have to provide the implementation of what you want to replace, not the entire control or any of the implementation above what you're replacing.

The trick is knowing what in the XAML tree you need to replace, and where in the tree you need to provide it. Say you want to replace the Text property of a TextBox with a set of async priority bindings. You don't need to provide all the other XAML for a TextBox. You just need to specify the bindings:
XAML
<TextBox>
  <TextBox.Text>
    <PriorityBinding>
      <Binding Path="SlowProperty" IsAsync="true" />
      <Binding Path="MediumProperty" IsAsync="true" />
      <Binding Path="FastProperty" />
    </PriorityBinding>
  </TextBox.Text>
</TextBox>

There isn't a XAML and C# component to a control. XAML is run through a compiler to generate the C# code. They are interchangeable, not complimentary to each other. The C# code for the control can exist entirely without XAML and the control will still work just fine. XAML is just a structured representation of a bunch of C# classes with properties being set.

Can you replace the ContentControl of a ComboBox? Sure. Can you replace the XAML and provide your own render code for the Combo? Again, sure.

Is it appropriate to do this? I have no idea what you're trying to do with the Combo, so I can't say.

It's also possible to build your own control that looks and acts like a Combo, but doesn't use a ComboBox, or is even based on the existing ComboBox, control at all. You can build one using a TextBox and a PopUp control to do weird stuff like a "ComboBox" that drops down and shows a bunch of TreeView controls in it.


modified 15-Jun-24 12:16pm.

GeneralRe: Custom Control Based On Combobox - Replace Part Of The Combobox Pin
Kevin Marois15-Jun-24 10:13
professionalKevin Marois15-Jun-24 10:13 
QuestionInvoke WPF Pin
geomeo1231-Jun-24 15:31
geomeo1231-Jun-24 15:31 
AnswerRe: Invoke WPF Pin
Richard Deeming3-Jun-24 21:38
mveRichard Deeming3-Jun-24 21:38 
GeneralRe: Invoke WPF Pin
geomeo1234-Jun-24 17:54
geomeo1234-Jun-24 17:54 
QuestionICommand Wpf form load properties? Pin
geomeo12330-May-24 14:11
geomeo12330-May-24 14:11 
AnswerRe: ICommand Wpf form load properties? Pin
Richard Deeming30-May-24 21:26
mveRichard Deeming30-May-24 21:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.