Hi,
How may I set the icon of a XamWebMenuItem programatically? I'm trying to do it but each time I got an erro when I try to open the menu :S
Cheers.
Hi
You can set icon programatically as shown follow:
public MainPage(){ InitializeComponent(); Loaded += new RoutedEventHandler(MainPage_Loaded);}
void MainPage_Loaded(object sender, RoutedEventArgs e){ // Create the image element. Image simpleImage = new Image(); // Create source. BitmapImage bi = new BitmapImage(); bi.UriSource = new Uri("icon_Welcome.png", UriKind.RelativeOrAbsolute);
// Set the image source. simpleImage.Source = bi;
((XamWebMenuItem)this.MyMenu.Items[0]).Icon = simpleImage;}
You should add your icon as a resource to your project.
Todor