Click here to Skip to main content
16,004,452 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Create event in UserControl Pin
jadughar3-Jul-11 22:15
jadughar3-Jul-11 22:15 
QuestionTwo-way binding requires Path or XPath error Pin
SledgeHammer0130-Jun-11 6:46
SledgeHammer0130-Jun-11 6:46 
AnswerRe: Two-way binding requires Path or XPath error Pin
Pete O'Hanlon30-Jun-11 6:56
mvePete O'Hanlon30-Jun-11 6:56 
GeneralRe: Two-way binding requires Path or XPath error Pin
SledgeHammer0130-Jun-11 7:08
SledgeHammer0130-Jun-11 7:08 
GeneralRe: Two-way binding requires Path or XPath error Pin
SledgeHammer0130-Jun-11 9:20
SledgeHammer0130-Jun-11 9:20 
QuestionRuntime Error 4008... Layout Cycle Detected... Layout Could Not Complete. Pin
NTheOne30-Jun-11 1:59
NTheOne30-Jun-11 1:59 
AnswerRe: Runtime Error 4008... Layout Cycle Detected... Layout Could Not Complete. Pin
Pete O'Hanlon30-Jun-11 2:34
mvePete O'Hanlon30-Jun-11 2:34 
QuestionIs this possible with HierarchicalDataTemplates? Pin
SledgeHammer0129-Jun-11 11:47
SledgeHammer0129-Jun-11 11:47 
My goal is to have a *reusable* TreeView control (lets call it MyTreeView) that fills in all the missing pieces of the current WPF TreeView. That is, I want to have out of the box support for images, checkboxes, node lines, etc. When I first started learning WPF, I wrote a MyTreeView control that does exactly this, so I know how to accomplish all that stuff... however, since I was just learning WPF at the time, it wasn't written very well and broke a lot of WPF functionality that I now fully undertand Smile | :) . So its time to rewrite it.

My issue is kind of which way to go with the core design. I know I don't want to give up the HierachialDataTemplate functionality (which I kind of did with v1), but I also know that I would ideally like to rely on the developer for how to get the data ONLY. I do not want the developer to have to deal with setting up the VisualTree. Thats my job.

I always see the HierachialDataTemplates set up like this:

<HierarchicalDataTemplate x:Key="TreeViewItemTemplate" ItemsSource="{Binding Value}">
<TextBlock Text="{Binding Key}" />
</HierarchicalDataTemplate>

That does populate the tree and I would like to keep that functionality, but I'd like to do something where instead of specifying a TextBlock like everybody does, I'd like to have something along the lines of:

<HierarchicalDataTemplate x:Key="TreeViewItemTemplate" ItemsSource="{Binding Value}">
<ItemTextBinding="{Binding Key}" ItemImageBinding="{Binding ImageSource}" ItemIsCheckedBinding="{Binding IsChecked}" />
</HierarchicalDataTemplate>

Doesn't have to be that exact syntax, but you get the idea... instead of specifying the VisualTree, I want to specify how the various UI elements should be data binded (or bound?).

Some issues that I haven't figured out:

1) I can't have attached properties on HierarchicalDataTemplate, so I'd probably have to derive a new class called TreeViewDataTemplate or whatever and force the developer to use that?

2) Doesn't seem possible to set properties on TreeViewItem from within the HierarchicalDataTemplate?

3) the highlight / focus rectangle covers everything in the HierarchicalDataTemplate VisualTree, fine for Vista / Win7 since thats the style, but on XP, thats not the style... the image and checkbox is not included in the highlight rectangle.

If #2 is not possible in anyway, it seems like this idea is kind of dead in the water... I did a similiar thing for ListView, but that had a clean place where the containers are created and I could easily hook into and set up all the data binding... doesn't seem to be the case here.
QuestionShift path Pin
Lutosław27-Jun-11 22:37
Lutosław27-Jun-11 22:37 
AnswerRe: Shift path Pin
Mark Salsbery28-Jun-11 10:21
Mark Salsbery28-Jun-11 10:21 
GeneralRe: Shift path Pin
Lutosław28-Jun-11 10:48
Lutosław28-Jun-11 10:48 
GeneralRe: Shift path Pin
Mark Salsbery28-Jun-11 10:59
Mark Salsbery28-Jun-11 10:59 
QuestionHow to keep two Combo Boxes in sync with WPF [modified] Pin
Member 297299227-Jun-11 9:42
Member 297299227-Jun-11 9:42 
AnswerRe: How to keep two Combo Boxes in sync with WPF Pin
SledgeHammer0127-Jun-11 11:22
SledgeHammer0127-Jun-11 11:22 
AnswerRe: How to keep two Combo Boxes in sync with WPF Pin
Mycroft Holmes27-Jun-11 12:59
professionalMycroft Holmes27-Jun-11 12:59 
Question[SOLVED] Child Window Not Working Properly Pin
AmbiguousName27-Jun-11 0:48
AmbiguousName27-Jun-11 0:48 
AnswerRe: Child Window Not Working Properly Pin
Mycroft Holmes27-Jun-11 1:15
professionalMycroft Holmes27-Jun-11 1:15 
AnswerRe: Child Window Not Working Properly Pin
AmbiguousName27-Jun-11 1:17
AmbiguousName27-Jun-11 1:17 
QuestionHow click more that visible row in DataGrid Pin
tâzn27-Jun-11 0:09
tâzn27-Jun-11 0:09 
AnswerRe: How click more that visible row in DataGrid Pin
Mycroft Holmes27-Jun-11 1:17
professionalMycroft Holmes27-Jun-11 1:17 
GeneralRe: How click more that visible row in DataGrid Pin
tâzn27-Jun-11 5:22
tâzn27-Jun-11 5:22 
GeneralRe: How click more that visible row in DataGrid Pin
Mycroft Holmes27-Jun-11 12:54
professionalMycroft Holmes27-Jun-11 12:54 
QuestionAny way to copy / clone XAML resources? Pin
SledgeHammer0124-Jun-11 18:17
SledgeHammer0124-Jun-11 18:17 
AnswerRe: Any way to copy / clone XAML resources? Pin
SledgeHammer0124-Jun-11 18:30
SledgeHammer0124-Jun-11 18:30 
AnswerRe: Any way to copy / clone XAML resources? Pin
Mark Salsbery24-Jun-11 18:35
Mark Salsbery24-Jun-11 18:35 

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.