 |
|
 |
Hi Josh,
I will be very greatfull to you if you supply any precious advice on it, as I am stuck in it and not getting anything to make it work.
Please reply soon as I know it must be some tricky style changes but as i am new to WPF so it will take time for me.
Thank & Regards
Gufran Sheikh
|
|
|
|
 |
|
 |
Hi,
I had hope that Josh will reply something about my question but may be that "MVP" is not having time to help the community, anyway I know programmers dont get time but atleast if you say that "I am running out of time please find it out yourself" or anything else so I should try some otherways and leave the hope for getting reply.
Anyway great article.
if the above post hurt you or I have written something wrong then the administrator can delete this.
Thanks & Regards
Gufran Sheikh
|
|
|
|
 |
|
 |
Gufran Sheikh wrote: I had hope that Josh will reply something about my question but may be that "MVP" is not having time to help the community, anyway I know programmers dont get time but atleast if you say that "I am running out of time please find it out yourself" or anything else so I should try some otherways and leave the hope for getting reply.
Get a grip, man. Do you realize how many questions I get from people every single day? A lot! Just because I'm an MVP does NOT mean that I'm required to answer every random question that strangers decide to throw at me. I'm extremely busy and just can't keep up. If you have a problem with that, too bad.
|
|
|
|
 |
|
 |
Also, I was going to look into your question this weekend. It was on my list of TODOs. But, now that you've complained about me, I'm not going to help you.
|
|
|
|
 |
|
 |
Hi Josh,
I have not complained against you I just wanted a reply whatever it is, as i mentioned I know programmers are very busy thats why just a little reply that "I am busy I will look into it meanwhile keep trying" will enough for the people.
Sorry it hurts you, it was not my intention to hurt you, anyway I am always looking for your great articles.
and I think I got the answer so thank you very much as atleast you replied me I am much satisfied with it.
Thanks & Regards
Gufran Sheikh
modified on Saturday, October 25, 2008 8:29 AM
|
|
|
|
 |
|
 |
Gufran Sheikh wrote: and I think I got the answer so thank you very much as atleast you replied me I am much satisfied with it.
Good, I'm glad at least something positive came out of this thread.
|
|
|
|
 |
|
 |
Hi
First of all, your article is so helpful! Good job!
I am trying to use this layout in a case where my treeview has more than one root (first-level) items, but I get their relative subtrees one on top the other. The must be something really small I'm missing, but I'm new to WPF and I was wondering if you can point me to the right direction.
Thanks
|
|
|
|
 |
|
 |
Awesome article as always! Great job.
I'm playing around with the sample and havent been able to render the items vertically instead of horizontally. Have you tried this layout?
Update:
Using Gideon Engelberth's suggestion, applying:
<TreeView.LayoutTransform>
<RotateTransform Angle="270" />
</TreeView.LayoutTransform>
Solves the initial layout, the only problem being that I somehow have to revent the layout transform at the "leef" node level, back to 90º. All and all, good stuff
Update:
Aha, re-reading the advanced treeview tutorial, I think I've found a way to make it all work, by checking the TreeViewItem.HasItems property and applying a different template, then resetting the transform.
I'll see if this works.
modified on Thursday, June 19, 2008 4:45 PM
|
|
|
|
 |
|
 |
I have spent 2 days of googling and listening presentations trying to learn more about WPF. If I correctly understood, WPF is used for making independent applications, wrote completely in XAML and it cannot be incorporated into existed VB.NET applications. Is that true?
I was looking for a way to implement skins into my application and it seemed to me that the WPF could be a nice way to do it. Am I on the right track or not?
|
|
|
|
 |
|
 |
virtual.aussie wrote: If I correctly understood, WPF is used for making independent applications, wrote completely in XAML and it cannot be incorporated into existed VB.NET applications. Is that true?
Well, it depends on what you mean by "existed VB.NET applications." If you are referring to a VB.NET WinForms app, you can use WPF controls there. If you mean ASP.NET apps, you can compile some WPF app into an XBAP and serve that up to the user.
WPF apps are not necessarily written only in XAML. You can use code if you want to. In fact, XAML is not at all necessary!
virtual.aussie wrote: I was looking for a way to implement skins into my application and it seemed to me that the WPF could be a nice way to do it.
I wrote an article about creating skinned UIs in WPF, check it out here[^].
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
 |
|
 |
Hi,
I am wondering how do I add a new node to the tree.
As it is, it shows the whole structure, but does not allow to add a new node after it is initially loaded.
I want to add a node to the selected node in the tree.
I tried to add a node object to the ChildNodes generic list, but the treeview does not seem to see the changes. I cannot bind to the ItemsTemplate since the Node object does not have that kind of properties.
Any ideas?
|
|
|
|
 |
|
 |
Your question is not related to the subject of this article. Please post general WPF questions to Microsoft's WPF Forum[^]. Thanks.
:josh:
My WPF Blog[ ^]
Without a strive for perfection I would be terribly bored.
|
|
|
|
 |
|
 |
Hi,
I created a XAML tree and wants to set a selected Item explicitly. I tried couple of ways like by setting SelectedValuePath value but it is not showing a default selected node in expanded tree.
I was wondering if there is a way around to set this. Will really appreciate your help.
Thanks
Anshu
|
|
|
|
 |
|
 |
Try:
(iSender as TreeViewItem).IsSelected = true;
|
|
|
|
 |
|
 |
I tried this but the Item Type returned after selected a Node is TreeView type not TreeViewItems. so I was wondering if there is any other way around to set this explicitly.
Thanks
Anshu
|
|
|
|
 |
|
 |
My apologies. If you use the first parameter of the event you do indeed get the TreeView type. You can get the TreeViewItem object through the RoutedEventArgs.OriginalSource property. Usually this is a Visual inside of the TreeViewItem. If you go up the Visual tree you eventually get the TreeViewItem. This can be done in various ways, you can do it manually (like the example I have included) or, I believe, you can also use ItemsControl.ContainerFromElement, if you know the object that contains it in it's ItemsSource. Unfortunatly, since a TreeView is Hierarchical, you usually don't know this if the event is added to the TreeView itself. So for the TreeView, I use the VisualTreeHelper class to walk up the visual tree.
I have included the complete example this time, which should be more clearly. The event is the ContextMenuOpening event. Basically it makes certain that when the context menu is shown, the TreeViewItem is always selected (which doesn't happen automatically if the user only presses the right mouse button).
void ValuesTreeContextMenuOpening(Object aSender, ContextMenuEventArgs e)
{
DependencyObject iSender = e.OriginalSource as DependencyObject;
while (iSender != null && !(iSender is TreeViewItem))
{
iSender = VisualTreeHelper.GetParent(iSender);
}
if (iSender is TreeViewItem)
{
(iSender as TreeViewItem).IsSelected = true;
}
}
|
|
|
|
 |
|
 |
I need to have one node selected as default. is that possible in this tree view? it seems above examle i need user input.
|
|
|
|
 |
|
 |
Hello,
Thank you very much for the example, it did give a good start.
i tried modifying the above for my needs but I am stuck
I need to
- All nodes of the same size, centre aligned.
- Space between 2 node always should remain the same.
Regards
Sophia
|
|
|
|
 |
|
 |
If I understand you correctly, it sounds like you should use a DockPanel as the ItemsPanel for each TreeViewItem, not the StackPanel used in the demo app. Set the TreeViewItem Style to have the DockPanel.Dock attached property set to 'Top' so that all of the nodes are aligned with the center of their respective parent.
The space between nodes can be adjusted by tweaking the Margin and/or Padding properties on elements.
:josh:
My WPF Blog[ ^]
Donny: Are these the Nazis, Walter?
Walter Sobchak: No, Donny, these men are nihilists. There's nothing to be afraid of.
|
|
|
|
 |
|
 |
Hi,
Is it possible to make all the item the same size?
Also, how do I add a line between the items?
|
|
|
|
 |
|
 |
salsafyren2 wrote: Is it possible to make all the item the same size?
Yes, in the ControlTemplate there is a Border. Set it's Width and Height properties to some value. That will probably do the trick. Note, that will prevent the items from auto-sizing to their contents.
salsafyren2 wrote: Also, how do I add a line between the items?
This post[^] on the WPF forum shows how to do that.
:josh:
My WPF Blog[ ^]
We are what we repeatedly do. Excellence then, is not an act, but a habit. - Aristotle
|
|
|
|
 |
|
 |
Thanks.
I am new to WPF which seems a bit complex to me.
I would like to have lines which goes from treeviewitem to treeviewitem. The post uses rectangular lines, which does not fit my purpose.
I read about databinding here: http://msdn2.microsoft.com/en-us/library/aa480192.aspx
but I don't know how to databind a lines x1, y1,x2,y2 to the graphical representation of the treeviewitem. The line should go from the center of an item's bottom to the center of the top the child item.
If you know howto do that, I would appreciate it.
I read something here:
http://blogs.msdn.com/adrianvinca/archive/2006/03/07/SimpleGraphSample.aspx
but I am not sure how to translate that to my case.
|
|
|
|
 |
|
 |
Sorry, I don't know how to do what you are looking to do. I've haven't been down that path yet. If you figure it out, write an article about it and post it here on CP!
:josh:
My WPF Blog[ ^]
We are what we repeatedly do. Excellence then, is not an act, but a habit. - Aristotle
|
|
|
|
 |
|
|
 |
|
 |
Well done! That's a nice solution. Thanks for sharing it. Keep up the great work.
P.S. I tried to leave this comment on your blog, but, after clicking the submit button, it told me that I need to log in.
:josh:
My WPF Blog[ ^]
All of life is just a big rambling blog post.
|
|
|
|
 |