WinRT XAML Toolkit treeview exapander button functionality to heading items - c#

I'am developing a windows store application, I have used WinRT XAML Toolkit tree view control for display hierarchical data.
Tree view is populate and working correctly. But I need to do small change, in the treeview it has expander button. I need that functionality into heading item. When user click on heading it should work like expander button. I want to expand the node if user click that heading also. How can i do this? Thanks

You can put a Button or ToggleButton as an item or in ItemTemplate (depending on whether you are using ItemsSource to populate the TreeView with nodes) and handle a Click event on the Button to toggle the node's expansion state.

Related

WPF Settings Page; Hiding/Showing Controls; Best Practice

In WPF, I am trying to create a settings page like the one in Visual Studio (Tools -> Options) (http://i.imgur.com/Be9cTPF.png)
I realize the selection menu is a treeview but I am unsure how to hide/show the controls on the right.
What is the best and proper way of doing this in WPF?
In my opinion the best way to do this is to divide the page into 2 grid columns. In your first column, you can place the treeview. The second column will consist of the data page. You can bind the visibility of this grid column when there is a selection in the tree view using a converter or so or display a default view there.
You can handle the selection changed event of the treeview and bind the selecteditem to a property and as per the selecteditem you can change the view on the second column.
Hope this helps.

Dragdrop from treeview to panel or other control in wpf using c#

I need to drag and drop the content from a treeview to a panel or group box where it needs to looks like below image
For each item which i drag from treeview and drop it into the panel must create a
box like this and get added into that place holder..**Is it possible in wpf c#?**If so any tutorial available.? I am really new to wpf . I checked on telerik and there doesn't seems any functionality like this..
You can use Drag from tree and drop to panel. Example here
When drop event handler rises you should create box Control and add to panel

Getting the Selected Item among items present in Grid

I am implementing a Media Player application using WPF. I want to display a List Screen where the user can select the video from a list.
I want to display the videos in a list horizontally(without scrollbars so not using ListView) where each item consists of a thumbnail, title and duration.
Now I also want to obtain which item was clicked on so as to play the correct video. I tried to display the items in a WrapPanel which sufficed for display but doesnt have a SelectedIndex property.
Will a Grid be helpful in this regard? If yes then how do I obtain which item was selected in the Grid?
Use a ListBox.
WPF UI elements keep their appearance separate from their functionality. If you want a list of items where you can select one, use a ListBox. If you want to customize how it looks, simply change its Template.
Grid, WrapPanel, StackPanel and the like are just Panel UI element which are used for Layout. They don't derive from Selector and thus don't have any item selection features.
Since you didn't post any relevant XAML in your question, I'll not post any relevant XAML in my answer.

How design left menu panel

in windows wpf i want design a left bar menu like this:
when i click on an item, in the right the window change.
With which control can i design this?
Tab bar control?
Or a left dock panel and insert inside it some button? In this case how can I change the window on the right when click on a button?
If each time you click on a button you want to display a different view, you could define each of your views in a separate control and in your main window within a grid declare each view in a DockPanel.
Then by binding the visibility property of each DockPanel you can create the logic in order to display only what you want on each click.
I suggest using a styled ListBox and binding the Visibility property of your content to it. Even better you can also use a styled Tab control.

Silverlight TreeView KeepSelected .. How?

Silverlight TreeView doesnt have KeepSelected method as in Winforms.
When TreeView loses focus - the selection isnt visible however the items is still selected..
I'd like to preserve selection visual even if TreeView lost its focus.
Anyone tryied to work around this?
You can write a custom style or template for the treeview node, so that it would display the color of selected item as per your choice even when it is out of focus.

Categories