Adding an image to a button in XAML - silverlight

I'm trying to add an image to a button in my silverlight 3 application but cannot get the image to appear. I added a folder, named \images, to my Silverlight application folder and an using a relative path in the Source attribute of the Image. What am I doing wrong?
<Button Width="200"
Height="200">
<Image Source="images\document.png"></Image>
</Button>

The easiest way to find out what is going on is to add an event handler for the ImageFailed event to see what URL it is trying to use.
You should probably try using forward slashes instead of back slashes, but I'm not sure if that is the real issue.

Related

Disable `show code` button in Canvas storybook

I use Canvas tag from storybook:
<Canvas>
<Story name="Hello">
{MyStory.bind({})}
</Story>
</Canvas>
If i add this code in my .mdx file there appear the code source, but i want to disable the button that is responsible to show the source code.
Question: How to achieve what i described?
I think you need to remove the Canvas tag, it should most likely remove the show code button.

Enlarge and Styling for Xceed.Wpf.AvalonDock Drop Down Button

Hi I'm new to AvalonDock and currently I have to handle on a task on others code which implemented this Xceed.Wpf.AvalonDock. My goal is to make the UI become touch screen friendly and first thing I need to enlarge the "Search Tab Button", I'm not sure the actual name of that button, it is used to show all the existing tab which may hidden or be showing on the header. Just like the Google Chrome, there is a button which used to search the opened tab on the upper right corner. Google Chrome Search Tabs
Can anyone help to give some solution or advice on how to enlarge the "Search Tab Button" ?
search tab button
I was able to change the size of the Menu Item, but not the button size. Below is the code that I tried to change the size of the Menu Item.
<xcad:DockingManager.DocumentPaneMenuItemHeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Content.Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="10" FontSize="18"/>
</DataTemplate>
</xcad:DockingManager.DocumentPaneMenuItemHeaderTemplate>
Trial Result
The problem is I don't know how to change the button size.
I search through the web, and the only things I found is this Dirkster99/AvalonDock, unfortunately it is not used for Xceed.Wpf.AvalonDock. Help~ Thanks!
https://stackoverflow.com/a/35417749/14891562
Alright, struggling to find shorter solution from the entire web.
In the end, this is what I found, which help me to change the style of the DropDownButton. Thanks to the author!
To enlarge the button, I follow the instruction of the link above to create a resource dictionary for the entire DocumentPaneControlStyle. From there I change the "Width" and "Height" of the xcad:DropDownButton/
Conclusion, AvalonDock is tough! :'(

How to stay in and change the current Silverlight URL window

In regards to this question:
<HyperlinkButton NavigateUri="http://www.microsoft.com" Content="Go to Microsoft" TargetName="_blank"/>
This opens a new window or tab to a external URL. The External URL navigation is correct, but how can we stay in the same window and tab?
if using HyperLinkButton, set TargetName to "_self" will open link in current page.
Answer from:
http://social.msdn.microsoft.com/Forums/en-US/silverlightdevtools/thread/250d546a-3237-4f7d-a146-b31e58191adf/

Is there a WPF equivalent for ToolStripButton?

I'm learning WPF and have been trying to create a toolstrip. Is there a direct equivalent of the WinForms ToolStripButton or is the correct way of use just to add a normal button and format it?
I've found that Microsoft have a page that lists WinForm controls and their WPF equivalents here but that doesn't mention the toolstripbutton.
You can just put buttons inside a ToolBar and it will change the style of the buttons to make them look like a toolbar.
<ToolBar>
<Button>Save</Button>
<Button>Open</Button>
</ToolBar>
Looks like this:
If you want images in the buttons, you have to do the normal thing of modifying the content of the button.
<Button>
<Image Source="..." />
</Button>

Free control - Hybrid LinkLabel and HtmlTextBlock for Silverlight 3

I need a simple HTML renderer ( like HtmlTexBlock ) which also allows to intercept click on custom defined link ( like LinkLabel ) looking like hyperlink. Does anything like that exist as free software ?
I don't know of any but if you only want one link in your html text could you maybe template a button using the htmltextblock as the content and capture the click event and navigate to desired page. I know it will not work if you have multiple links in your html text however it is unclear what your exact requirment is.
eg.
<Button x:Name="btnhtml" Width="63" >
<htmltextblock Text="Hello World"></htmltextblock>
</Button>

Resources