Select to view content in your preferred language

Package Tools

1365
14
10-22-2010 01:30 PM
JayKappy
Frequent Contributor
I am looking at this web site for direction.
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#AttributeQuery
There are a bunch of query tools like Find, identify, spatial query etc.

What I want to do is get these in a Tool bar and fire them from a button....how do I do that...by placing teh code randomly in the xaml file it runs right off the bat....I only want to fire that tools code when I click the button.....

Thanks in Advance....very new to this....apprciated.
0 Kudos
14 Replies
TerryGiles
Frequent Contributor
Hi Jay,

I started with one of the application templates from the resource center - http://help.arcgis.com/en/webapi/silverlight/gallery.html.  Look for the 'unblended' template - it has a toolbar with an identify button on it that should help you get going. 
Also check out this forum post  - http://forums.arcgis.com/threads/9124-Identify..?highlight=graphic+visible

Terry
0 Kudos
JayKappy
Frequent Contributor
I downloaded an example from ESRI website.
http://help.arcgis.com/en/webapi/sil...yWeb/start.htm
I used the last example...the ShowCase example.
I am very new to this and looking to learn. I noticed once I opened it up in Visual Studio that there were additional Folders. IE "UserControls"

Did they simply make a new folder?
Then create a new File
THen Create a new Silverlight control?

I am trying to replicate this although in VB...I think the code is in CSharp.
My main issue is getting all three parts to work and see the Name Space.....I cant seem to get this to work....

How does this work...the MainPage.xaml points to the folders .xaml file with then calls the namespace?

I know this is pretty vague question but just trying to get a drop down button holding tools to work....thanks in advance
0 Kudos
dotMorten_esri
Esri Notable Contributor
This is some of the very basic of Silverlight development, so I would suggest you look through the tutorials on Silverlight, especially #3 and #4: http://www.silverlight.net/learn/quickstarts/ and http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-ma...

On a side note the sample you refer to is a very advanced sample. If this is among your first ventures into Silverlight, you are in for a challenge 🙂
The "sample" is nver built to be reused or customized. It's just a sample that showcases some of the features that the API can do. It's not a very good end-user app.
0 Kudos
JayKappy
Frequent Contributor
THanks for the info.....And sorry if this does not make much sense...frustrated adn confused here.....I referenced 3 and 4...I understand these controls, I have been adding controls from the ArcGIS resource center.......What I was refering to in the example was in Visual Studio, in the project file there were additional folders adn files that contained extra cs pages that were called/referenced from the main xaml file....This was not covered in 3 and 4 on the tutorial you posted...I was trying to figure that out...how adn where it was referenced in the main xaml file and where else.....

You look adn there is a folder with extra cs pages there...Looks like the person right click the main project name in VS and chose NEW FOLDER....Did the person then add a SIlverlight app, Silverlight User Control, SilverlightPage?

KBar, MenuIcon, SubButton referenced below were additional cs files in the project. They each had a new namespace ex KBar....which is called in themain xaml file seen below....What kind of NEW ITEM was created to create these when you right click the folder that was added?

<src:KBar x:Name="MyIC" Margin="10" Width="400" HorizontalAlignment="Left" CurrentTool="None">
            <src:KBar.Items>
                <src:MenuIcon ImgSource="Assets/images/i_globe.png" ButtonText="Map">
                    <src:MenuIcon.Items>
                        <src:SubButton ButtonID="streetmap" ImgSource="Assets/images/i_highway.png" ButtonText="Street Map" Click="OnClick" />
                        <src:SubButton ButtonID="satellite" ImgSource="Assets/images/i_satellite.png" ButtonText="Satellite Map" Click="OnClick"/>
                        <src:SubButton ButtonID="overview" ImgSource="Assets/images/i_overview.png" ButtonText="Overview Map" Click="OnClick"/>
                    </src:MenuIcon.Items>
                </src:MenuIcon>



Is ESRI against VB or something....Every example I looked at was in CS no VB example...



This is some of the very basic of Silverlight development, so I would suggest you look through the tutorials on Silverlight, especially #3 and #4:   http://www.silverlight.net/learn/quickstarts/ and   http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-6-using-user-controls-to-implement-ma...
  
On a side note the sample you refer to is a very advanced sample. If this is among your first ventures into Silverlight, you are in for a challenge 🙂 
The "sample" is nver built to be reused or customized. It's just a sample that showcases some of the features that the API can do. It's not a very good end-user app.
0 Kudos
JenniferNery
Esri Regular Contributor
The first link you shared http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/samples/start.htm#AttributeQuery has a corresponding VB code (see Code Behind VB tab).


KBar, MenuIcon, SubButton referenced below were additional cs files in the project. They each had a new namespace ex KBar....which is called in themain xaml file seen below....What kind of NEW ITEM was created to create these when you right click the folder that was added?


If KBar, MenuIcon, SubButton belong to different namespaces, then you cannot use a single xaml namespace for them <src:Kbar../>, <src:MenuIcon../>.
Instead, you will need separate xaml namespace definition for each like:
xmlns:srcKBar="clr-namespace:MyKBarNamespace"
xmlns:srcMenuIcon="clr-namespace:MyMenuIconNamespace"

Usually though, files belonging to the same project have the same namespace. When folders are added, and you add new item (for example, UserControl) underneath that folder, a new namespace is created with that folder name. It is up to you to keep or edit this new namespace. You just need to know how to access them in xaml and code-behind. While code-behind have Imports/using statements, XAML also have xmlns.

I hope this helps somewhat.  Try to start with a very simple project first (it does not need to be one of our SDK samples right away) just to get a feel of what goes where and how they come together.
0 Kudos
JayKappy
Frequent Contributor
Jennifer...thanks for your thougths....I have been trying...I have added a few controls from ESRI silverlight WPF Api resource center....but I am now simply trying to add a box with a couple buttons in it....when you hover over one of the image it expands and contains options, tools etc...
I have not foudn a simple VB example to follow....everything I have foudn similar to this is CS and has tons of folders with additional cs files etc.

Any example with one button/image that drops down and links to a zoom tool is all I am looking for.

Anyone out there know of an easy example in VB?

If I dont use KBar, MenuButton, SubButton as seen in code in previos entry what do I use as a SRC?
0 Kudos
JenniferNery
Esri Regular Contributor
When you see examples in C# and there's no VB equivalent available, you might want to try and use an online converter C# to VB like this one http://www.developerfusion.com/tools/convert/csharp-to-vb/


Any example with one button/image that drops down and links to a zoom tool is all I am looking for.


Have you looked at the ToolBar sample?http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#ToolBarWidget

You can use a ComboBox with Image items and write code for the SelectionChanged event handler
   <ComboBox VerticalAlignment="Top" HorizontalAlignment="Center" Height="55" Width="70" SelectedIndex="0"  SelectionChanged="ComboBox_SelectionChanged">
   <ComboBox.Items>
    <Image x:Name="ZoomIn" Source="images/i_zoomin.png" Height="35" Width="35" Stretch="None"/>
    <Image x:Name="ZoomOut" Source="images/i_zoomout.png" Height="35" Width="35" Stretch="None"/>
   </ComboBox.Items>
  </ComboBox>



I'm not really sure how your project is setup so I can't tell you how to use the KBar, MenuButton, SubButton.  However you can download the SDK sample if it would be easier to view and learn the project structure that way.
0 Kudos
JayKappy
Frequent Contributor
THis is what I am trying from your thoughts......nothign showing up....

anyone have any thoughts....I am tryign to get a button to show up on the tool bar...when clicked it opens to give the two choices....(zoom in and zoom out)


            <!-- ToolBar -->
            <Grid Height="60" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0,10,10,0" >
                <Rectangle Fill="#22000000" RadiusX="10" RadiusY="10" Margin="0,4,0,0" />
                <Rectangle Fill="#775C90B2" Stroke="Gray"  RadiusX="10" RadiusY="10" Margin="0,0,0,5" />
                <Rectangle Fill="#66FFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Margin="10,10,10,15" />
                <StackPanel Orientation="Vertical">
                    <esriToolkit:Toolbar x:Name="MyToolbar" MaxItemHeight="40" MaxItemWidth="40"
                    Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Center"
                    Loaded="MyToolbar_Loaded"
                    ToolbarItemClicked="MyToolbar_ToolbarItemClicked" 
                    ToolbarIndexChanged="MyToolbar_ToolbarIndexChanged"
                    Width="320" Height="40">
                        <esriToolkit:Toolbar.Items>
                            <esriToolkit:ToolbarItemCollection>
                               
                                <esriToolkit:ToolbarItem Text="TESTING">
                                    <esriToolkit:ToolbarItem.Content>
                                        <ComboBox HorizontalAlignment="Center" SelectionChanged="ComboBox_SelectionChanged">
                                            <ComboBox.Items>
                                                <Image x:Name="ZoomIn" Source="/Assets/images/i_zoomin.png" Stretch="UniformToFill" Margin="2"/>
                                                <Image x:Name="ZoomOut" Source="/Assets/images/i_zoomout.png" Stretch="UniformToFill" Margin="2"/>
                                            </ComboBox.Items>
                                        </ComboBox>
                                    </esriToolkit:ToolbarItem.Content>
                                </esriToolkit:ToolbarItem>                                
                                <esriToolkit:ToolbarItem Text="Zoom In">
                                    <esriToolkit:ToolbarItem.Content>
                                        <Image Source="/Assets/images/i_zoomin.png" Stretch="UniformToFill" Margin="2" />
                                    </esriToolkit:ToolbarItem.Content>
                                </esriToolkit:ToolbarItem>
                                
                                <esriToolkit:ToolbarItem Text="Zoom Out">
                                    <esriToolkit:ToolbarItem.Content>
                                        <Image Source="/Assets/images/i_zoomout.png" Stretch="UniformToFill" Margin="2" />
                                    </esriToolkit:ToolbarItem.Content>
                                </esriToolkit:ToolbarItem>
                            </esriToolkit:ToolbarItemCollection>
                        </esriToolkit:Toolbar.Items>
                    </esriToolkit:Toolbar>
                    <TextBlock x:Name="StatusTextBlock" Text="" FontWeight="Bold" HorizontalAlignment="Center"/>

                </StackPanel>
            </Grid>


I am trying to replicate soemthing like this:

<src:MenuIcon ImgSource="Assets/images/i_nav.png" ButtonText="Nav">
<src:MenuIcon.Items>
<src:SubButton ButtonID="zoomin" ImgSource="Assets/images/i_zoomin.png" ButtonText="Zoom In" Click="OnClick"/>
<src:SubButton ButtonID="zoomout" ImgSource="Assets/images/i_zoomout.png" ButtonText="Zoom Out" Click="OnClick"/>
<src:SubButton ButtonID="fullextent" ImgSource="Assets/images/i_zoomfull.png" ButtonText="Full Extent" Click="OnClick"/>
<src:SubButton ButtonID="pan" ImgSource="Assets/images/i_pan.png" ButtonText="Move Map" Click="OnClick"/>
</src:MenuIcon.Items>
</src:MenuIcon>
0 Kudos
JenniferNery
Esri Regular Contributor
Instead of using Image as ComboBox items, try to replacing them with <TextBlock Text="test"/> for now.  If you see this text "test" twice but was unable to see the images earlier, then your Uri may be incorrect or those images may not be added correctly to your project.
0 Kudos