Using a Silverlight Hyperlink Button Style without the Navigation - silverlight

In my page I want the button that looks like the HyperlinkButton (underline when MouseOver etc). But I want to handle the navigation in code (by using the Click event handler). So I'm using a HyperlinkButton and setting the NavigateUri to an empty string and setting the Click handler.
But the problem is that the browser tried to download the entire .xbap as a file download, presumably the empty NavigateUri mean "root".
Is there any way I can re-use the HyperLinkButton class (for visuals) but perform the actual navigation / or action in the Click method.

Open expression blend.
Right click on hyperlink button -> Edit style -> Edit copy
Change TargetType="HyperlinkButton" to TargetType="Button"
Use this style with any button.
Also, I have no problem with code
<HyperlinkButton Content="HyperlinkButton" Click="hb_Click"/>

Related

Create button in C# winform like IDM buttons

Did you see the first page of IDM (Internet Download Manager)??
IDM first form
Now i'm trying to build some buttons like these buttons(above picture) but I don't know how I must start? Is there any software for it? These buttons change their mode when hover mouse on them.
Have nice day
Start with a ToolStrip control and add a Button to it using the DropDown control on it. Change the DisplayStyle to ImageAndText, and TextImageRelation to ImageAboveText. Now change the Image property to your Icon image, and ImageScaling to None.
On the ToolStrip itself, change GripStyle to Hidden.

Silverlight HyperlinkButton inside RadTreeView

I use the RadTreeView to display a navigation; therefore, I need to show some HyperlinkButtons. I've got two issues:
1) Clicking the HyperlinkButton doesn't set the 'selected' state from the RadTreeViewItem (it seems like the HyperlinkButton won't bubble the click event up to the RadTreeViewItem?)
2) The HyperlinkButton is not at full width
Because of issue #2, I can select the RadTreeViewItem by clicking right next to the HyperlinkBytton, but this only selects the item and no navigation is triggered (which makes sense, because I didn't click the HyperlinkButton, just the item). But I want to be able to navigate by clicking anywhere; therefore, the HyperlinkButton needs to be at full width.
Can you please provide me some tips?
Thanks in advance for your help!!!

In my Windows Phone app,I want to turn my current page unable in gray and show a textbox in foreground

Like the title said,how may i turn the grid(or page) and the components in it into background gray and unable and show a new component in foreground.
It's a common effect in the web page,but i cannot do that with a xaml.
Please answer in detail better with sample code if you do.Thanks in advance.
Here's an example of using a Popup to display a UserControl when a Page is navigated to. The OnNavigatedTo function creates a popup, binds a Click event to the UserControl, and then shows the UserControl over the entire page. If the correct password is entered, ("password" in the example) the control disappears. You'll need to modify it for your own requirements, but it should definitely get you started.
https://skydrive.live.com/redir.aspx?cid=ef08824b672fb5d8&resid=EF08824B672FB5D8!343
You'll want to use the VisualStateManager and create some animation transitions to switch between the old and new components. I won't paste the code here for brevity, but if you check out:
http://visualstudiomagazine.com/articles/2011/07/22/wcmob_visual-states.aspx
You'll see a simple example of switching between two UI components on a single page within a Windows Phone 7 PhoneApplicationPage. In your scenario, you'd use this paradigm to create 2 animation storyboards, one for showing an overlay control and one for settings the 'disabled' property on the main grid.

How to inherit from silverlight Button?

I need to have button have 4 images that are changed by the application action.
I want to define new class ButtonEx that inherit from the Button class.
So, i did it by adding 'silverlight template control' and it to be inherit from control to Button.
Now, i cant see the images whan i put this ButtonEx on the page.
What i did wrong ?
How to fix it ?
( same code work fine in WPF )
Can you post any of your code? Did you create a visual style for it in themes\generic.xaml? Did you set the default style key?
I recently followed this tutuorial for a TextBox, you could so something similar for your button... http://www.silverlightshow.net/items/Create-a-Custom-Control-Inheriting-from-TextBox.aspx
Store your images as resources then create a user control that has
- a button and the content of the button is an image
- a property to select the image from the resources
use the usercontrol as your button.
please post a code sample...
to inherit form button you simply need this.
public class ButtonEx:Button
{
}
this will have all functionality that button has.
if you want new template just add it in Themes/generic.xaml
From your question its not clear that you really need to be subclassing Button. Maybe you can get by with just copying and modifying the template of button (Blend helps for this), or just have the image as content bound to some property for the application to change (using a ValueConverter perhaps).

Check button like in "solution explorer" in visual studio

there's "show all files" check button in solution explorer tab in visual studio. How can I make such a button ? /* give me a class */
My manager wants exactly the same button and it's behavior ..
Or is it not "free" button ?
Edit: I see some people didn't understand my question. Some explainations:
I need a check button exactly like in visual studio (like "show all files" button). I need a "check" bahavior when I clicked a button it shows some half-transparent blue layer on a button image. And I need a mouse hover behavior when a half-transparent blue layer added to a button image. I hope you understand my english
It is a button. Create a button, assign an image (if you want the pretty picture) and put an OnClick event handler in. In your event handler, you'll need to add the code to do what is required.
Solution Explorer provides you with an organized view of your projects and their files in treeview.You can do this
by implementing your own treeview and showing all the files and folders inside the root folder.
you can check this thread to get started with treeview
I need a check button exactly like in visual studio (like "show all files" button).
I'm assuming you need a button that looks like the button in VS, not a button that behaves like the button in VS.
It's a toolbar button. Add a Toolstrip to your form, add a button to the toolstrip, set the CheckOnClick property to true and add a custom image.

Resources