How can I link a Button to a TreeView? - silverlight-4.0

Hi everybody i'm new in this,i'm doing the designing a program(don't know barely nothing of coding), i need to link a button to a TreeView to appear,so when i click the button the treeview shows,when clicking other button,another treeview appears.
How can i do this?
Thanks
Im newbie!

Name the tree view controls with an x:Name attribute in the XAML. This will give you an instance which you can manipulate from code behind.
Subscribe to the click event of the button.
Set the Visibility property of the tree view to Visibility.Collapsed or Visibility.Visible in the click handler code.

Related

Button control as ListView DataTemplate container wrt Drag-and-Drop of ListView Elements

When I use a Button control in DataTemplate for ListView (UWP app), Drag-and-Drop of ListView items doesn't work. If I use containers like StackPanel, RelativePanel or Grid, instead of Button control, everything works fine. I would prefer the Button control as a container, because I like its mouse Hover effect on ListView items. I can do something similar for StackPanel, etc, with a custom hover effect by using a combination of Style and Behavior programming but trying to avoid this route (too involved).
Can I do something to the Button control so that it gives me the hover and also responds to the Drag-and-Drop event when part of a ListView DataTemplate?
I am also curious what specifically makes the Button suppress the Drag-and-Drop of ListView items.
The Button is capturing the pointer which cause the pointer click event not be bubble up to the ListViewItem which cause the Drag&Drop to start.
You can take a look at ReleasePointerCapture method which will release the pointer capture allowing other item to capture it.
You will need to create a new class which extends the default Button class and override for example the OnPointerPressed method to choose the logic between the drag&drop and the click on the button.

Silverlight Usercontrol in Datagrid does not fire the CellEditEnded event

I have a UserControl that is displaying in a DataGrid. It contains a DatePicker and a Button that opens a Popup control where the user makes a selection that once selected populates a textblock with the result. The DatePicker is the only object that if changed will set off the CellEditEnded event. How can I get the popup controls selectionChanged event to tell the Datagrid that the cell has done as edit?
Turns out I was putting the UserControl inside the CellTemplate when I needed to put something else in that for display and my UC in the CellEditingTemplate. Now it fires as it should. I missed something simple and I should not have. Hope this helps someone else.

Windows store xaml add button with click event handler to gridviewitem

I have a gridView the data is coming from a datasource.
How can i add a button to a gridviewitem datatemplate and add a click event handler to the button?
An alternative way is to not actually use a Button at all and simply setting IsItemClickEnabled to true and using the ItemClick event.
If you genuinely need to have a button in your ItemTemplate - the easiest way to add an event handler is to create a UserControl for use in the ItemTemplate, put the button in it and add the event handler inside of that UserControl.
The appropriate way to do this is to bind the command of your button to a command property on the DataContext of the item which is templated.

Glossy Button in VB.Net?

How to make glossy button in Vb.Net?
or
how change button background on mouseover?
If you are using WinForms, you usually achieve this by creating a new class inheriting from System.Windows.Forms.ButtonBase.
From there, overwrite OnMouseEnter, OnMouseLeave, and OnPaint to draw a button to your specifications.
hope my reply helps you
Select the button
Go to its properties and change the button style to FLAT
In the same property widow now select FLAT SETTINGS
And you can see color to appear when clicked or hover on it...

Problem with toolstrip renderer in VB.net

I'm using the toolstrip renderer in vb.net, found the source over at:
http://63.236.73.220/showthread.php?t=539578
Now, it works great however the style doesn't seem to stick when I click a button on the toolbar. I use a toolstrip sort of like tabs, and what I'd like is if a toolstrip menu is clicked the style stays so I can visually see what tab is clicked.
Can someone help me out with that?
I figured out the issue... Turns out the default toolstrip renderer supports the clicked item state, so I had to turn on the "checkonclick" to true and then when the the toolstrip button is clicked it shows the selected state, then in the code on the click event I did a loop to uncheck all other buttons in the toolstrip so now it functions exactly like a tab interface using the fancy toolstrip renderer :)