Vectorlight News

  • Chat App Converted to HTML and JQuery
    Sep 08, 2011

    Converted from Silverlight to HTML and Javascript/JQuery is the Vectorlight Chat App. Login using your Vectorlight password to chat using your username and avatar.

  • HTML5 iPhone,Android Big Guns Tower Defense
    Jul 02, 2011

    Big Guns has made the leap from Windows Phone 7 (XNA) to HTML5 so you can now play it on your iPhone, Android and other HTML5 compatible devices.

  • HTML5 Games - Word Poppers and Batty
    Jun 04, 2011

    As the take-up of HTML5 quickens (74% of users currently have a browser capable of HTML5 Canvas) we present two more games for both your browser and mobile.

  • Big Guns Tower Defense on Windows Phone 7
    May 06, 2011

    Coming soon to Windows Phone 7 is an XNA port of the popular Vectorlight tower defense game Super Tower Defense. Whilst retaining many of the graphical and gameplay features of the original Silverlight game.

  • Wakacube WP7 Update
    Apr 26, 2011

    Released to the Windows Phone 7 marketplace today is Version 1.1 of Wakacube the 3D physics game of skill. Included in the update are more levels (30 in total) and new mode Wakatime which generates random crate structures to keep players entertained long after the levels have been completed.

  • Home Page News
beaudetious
beaudetious
Setting Icons Programattically Posted: Mar 24, 2010
 

I like the CheckBoxes but I'd prefer to have my user's change the checked value by just selecting the item.  Being able to change the checked value is a bit confusing (I'd think) especially as the menu doesn't close changing the selected state.


What I'm after really is just a simple UI experience that would best be served by having the user click on an item and have an checked icon appear (and any other checked icons on other related items disappear).


So, in that end, I have a few questions.  In my example, I have the XAP file in the ClientBin directory and my images in an Images directory (at the same level as the ClientBin directory).  Knowing that, how do I programmatically set an icon and also how do I make an icon vanish?


My example XAML is thus:


<liquidMenu:MainMenu x:Name="mainMenu" ItemSelected="mainMenu_ItemSelected">

            <liquidMenu:MainMenu.Items>

                <liquidMenu:MainMenuItem Text="Edit" ShowChildMenuOnHover="False">

                    <liquidMenu:Menu>

                        <liquidMenu:MenuItem Text="Mouse Behavior">

                            <liquidMenu:Menu>

                                <liquidMenu:MenuItem Text="Mouse Wheel">

                                    <liquidMenu:Menu>

                                        <liquidMenu:MenuItem ID="subItemMWScroll" Text="Scroll"

                                                                           MouseLeftButtonDown="subItemMouseWheel_MouseLeftButtonDown"   />

                                        <liquidMenu:MenuItem ID="subItemMWZoom" Text="Zoom"

                                                                           MouseLeftButtonDown="subItemMouseWheel_MouseLeftButtonDown"   />

                                    </liquidMenu:Menu>

                                </liquidMenu:MenuItem>                                                                

                        </liquidMenu:MenuItem>                        

                    </liquidMenu:Menu>

                </liquidMenu:MainMenuItem>                

            </liquidMenu:MainMenu.Items>

        </liquidMenu:MainMenu>


And in my code behind:


private void subItemMouseWheel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

{

    Liquid.MenuItem subItemMWScroll = mainMenu.Get("subItemMWScroll") as Liquid.MenuItem;

    Liquid.MenuItem subItemMWZoom = mainMenu.Get("subItemMWZoom") as Liquid.MenuItem;


    switch (((Liquid.MenuItem)sender).ID)

    {

        case "subItemMWScroll":

            subItemMWScroll.Icon = "../images/check.png";

            subItemMWZoom.Icon = "";

            break;

        case "subItemMWZoom":

            subItemMWScroll.Icon = "";

            subItemMWZoom.Icon = "../images/check.png";

            break;

    }

}


Thanks,


Beaudetious

 
 
beaudetious
beaudetious
RE: Setting Icons Programattically Posted: Mar 24, 2010
 

I see that I can set an absolute URL like so:


subItemMWScroll.Icon = "http://localhost:56277/images/check.png";


and to clear it:


subItemMWScroll.Icon = "";


But I'm hoping to get some advice on how to use relative paths.


Thanks,


Beaudetious

 
 
dan
dan
RE: Setting Icons Programattically Posted: Mar 28, 2010
 

Hi Beaudetious,


The menu works fine with relative paths.  Assuming you have an image in your project in a folder called images and that image has a Build Action of Resource, the image path will be "images/check.png".  Can you confirm the Build Action and also the Copy to Output Directory is set to Do Not Copy?


Thanks!

 
 
beaudetious
beaudetious
RE: Setting Icons Programattically Posted: Mar 29, 2010
 

Here's how I'm setting the Icon path now:


((Liquid.MenuItem)sender).Icon = "..//resources/check.png";


Thanks,


Beaudetious

 
 

Rate this: 

1 Star 2 Star 3 Star 4 Star 5 Star
1 Rating / 5.0 Average