I am new in silverlight. I want to use context menu in treeview item in my silverlight 3 application .
I have searched in the net regarding this I have found my custom application for this but I am not getting them .How to use context menu, how to add rightclick event for using context menu .
Thanks in addvance
If you must do this immediately then this blog article describes how to use the plugin in windowless mode an then borrow the host broweser oncontextmenu event to detect the right mouse button. However I would hold off if you can and use Silverlight 4 which supports context menus directly. Its best to avoid windowless mode if you can.
Related
If you create an empty WPF app, and replace the MainWindow.xaml with the following:
<ribbon:Ribbon xmlns:ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary" />
(Note the use of the Ribbon class, not RibbonWindow as is used in most tutorials on the subject.)
Then delete MainWindow.cs and run the app.
It will give you a nice looking window with IE like navigation buttons and under that, the actual ribbon bar.
How do I use those navigation buttons? I have found lots of info on the rest of the Ribbon Bar, but not the navigation buttons.
I have an app with has a navigation stack and I just need to be able to fire an event when the user clicks forward/backward so I can have the app navigate. And of course, I need to be able to enable or disable them depending on the navigation stack.
I have looked, but I don't see any property of the RibbonClass that exposes the buttons.
Navigation buttons are part of the navigation mechanics built into WPF since its Avalon times. They have nothing in common with Ribbon.
See details here:
https://learn.microsoft.com/en-us/dotnet/framework/wpf/app-development/navigation-overview
Well, after no responses here, and no luck Googling, I have come to the conclusion that the navigation buttons are not officially supported, and there are no properties exposing them. I went as far as searching through the source code which is available as part of the WPF Ribbon Download but I found nothing.
So am going to mark this as answered for now.
I am really new to Silverlight. I am working through some of the sample codes I found online.
I notices sometimes a new "Page" is added, and sometimes a new "User Control" is added.What are the differences between those 2?
Btw, when I tried specifying the URL for a hyperlink as "www.apple.com", there is an error saying "www.apple.com" can not be found. Are there anyway of specifying an URL for a website for a HyperlinkButton?
Thanks :)
In SL3 and up; a Page correlates to the Navigation framework whereas a UserControl is a control providing a defined set of functionality using multiple controls which can then be used within a Page.
User Control:
When you build your project , any user control that you created will appear in the toolbox also. You can drag and drop it like any other control (like a button or a grid).User controls are used for enhanced flexibility. You can customize your controls, set as many properties you want , and it really simplifies things without going for creating custom controls.
Page:
However, when you come to a Page, you can use it mostly for Navigation . It can contain other controls , but it is mainly intended for Navigation within Frames.
I have a hopefully trivial question. Currently, my company works with a rather obscure language (SyngergyDE) and we need to call a SilverLight application inside our product. Unfortunately, this obscure 3rd party language only (currently) supports the opening of WPF screens. So with that said, I thought I'd develop a small WPF user control that contains a "WebBrowser" control and navigate to the silverlight application's URI. This works fine, and I'm able to see the SL application. Here is my question - we have a "Close" button on the SL application, and when users "Click" that button, we want the window to close.
Does anyone have any suggestions on how we can communicate the "Closing of the SL App" to the WPF user control, so that the entire WPF user control closes as well?
Thanks everyone,
-Tom
Attach an event handler to the WebBrowser.Navigated event.
Have the close button in the Silverlight application use:-
HtmlPage.Window.Navigate(new Uri("about:blank", UriKind.Absolute));
When the Navigated event fires in WPF with the url "about:blank" then its time to close the control.
Use Javascript and the HTML DOM as the glue here.
For example, when the SL app close button is clicked, have Silverlight trigger some Javascript code that sets a flag, or alternately, raises some HTML document event.
The WPF control could poll that flag in the HTML + Javascript, or alternately listen for that HTML document event, then close the user control.
Is this possible?
I used a Frame control and:
show(ex:showwindow.xaml)
But I get this error:
root element is not valid for navigation
sure you can navigate (show) a window by using:
YourFrame.Navigate(YourWindow);
However I don't like much this multi-window approach, better create some user controls for segmenting your application.
It is more common to use the Page class with the Frame control. Windows, in WPF are the top level items, with their own titlebar, chrome etc. Also, the Page can tap into the NavigationService provide by the framework.
more info about Navigation from Microsoft
I have a WPF application which contains a WebBrowser control.
Currently, the user can select something within the WebBrowser and can copy the content by dragging it out to another application and dropping it there.
I'd like to be able to stop the user doing this. I'd assumed that there would be a "DragStart" event that I could capture and cancel - but I haven't been able to find something so simple.
Is it possible to capture the start of drag event and cancel it?
Is there a better way to achieve this?
You can implement IDocHostUIHandler::FilterDataObject and filter out common clipboard formats
You don't get access the WPF browser's native interface until the document is ready. Not sure if it would work with the WPF browser class. There is also a bug in Windows Forms to prevent you from customizing its implementation of IDocHostUIHandler.
You can try some wrapper class of the webbrowser ActiveX, such as the one described at http://www.codeproject.com/KB/miscctrl/csEXWB.aspx