Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows Mobile - getting a row in a Grid

Posted on 2011-09-26
6
Medium Priority
?
219 Views
Last Modified: 2013-12-27
Just starting out with this so may be a simple question!

I have a listbox containing a grid which in turn contains stack panels to display a list of jobs which is set as the DataSource for the ListBox... .  Now I have a column in the grid for the job id and a column with an image which I click to edit the job on another page.  My xaml is shown below:-

 
<Grid Margin="0,0,0,10" Name="SelectGrid">
																		<Grid.ColumnDefinitions>
										<ColumnDefinition Width="90" />
										<ColumnDefinition Width="90" />
										<ColumnDefinition Width="50" />
										<ColumnDefinition Width="130" />
										<ColumnDefinition Width="50" />
										<ColumnDefinition Width="50" />
									</Grid.ColumnDefinitions>

									<StackPanel Grid.Column="0">
										<TextBlock Text="Job ID:" Foreground="#FFFFFF" FontSize="22" FontWeight="Bold" Margin="10, 0, 0, 0"  />
										<TextBlock Text="Postcode:" Foreground="#FFFFFF" FontSize="18" Margin="15, 0, 0, 0" />
									</StackPanel>

									<Grid Margin="0,0,0,10" Name="SelectGrid">
	<Grid.ColumnDefinitions>
		<ColumnDefinition Width="90" />
		<ColumnDefinition Width="50" />
	</Grid.ColumnDefinitions>

	<StackPanel Grid.Column="0">
		<TextBlock Text="Job ID:" Foreground="#FFFFFF" FontSize="22" FontWeight="Bold" Margin="10, 0, 0, 0" />
		<TextBlock Text="Postcode:" Foreground="#FFFFFF" FontSize="18" Margin="15, 0, 0, 0"  />
	</StackPanel>

	<StackPanel Grid.Column="1">
		<Image Name="View" Height="45" Width="45" Source="Images/view.jpg" Margin="-30, 0, 0, 0"  MouseLeftButtonDown="Text_MouseLeftButtonDown" MouseLeftButtonUp="ViewPatch_MouseLeftButtonUp"  />
	</StackPanel>
</Grid>

Open in new window


My question is :- how do I recover the Job ID when I click on the 'view' button in the row?  I am more used to working with WinForms where you would be able to get the row containing the clicked cell and from there to any other cell in the row.  Is there a similar approach to working with Windows Mobile 7?
0
Comment
Question by:ChrisMDrew
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 48

Expert Comment

by:Mikal613
ID: 36601817
When you set the image in the grid set the Tag to the job Id. On the button click handler just case the sender as a Button and take the JobID.
0
 

Author Comment

by:ChrisMDrew
ID: 36602066
How would I do that?  The ListBox and hence the grid is data bound and as such I don't explicitely create the image or any of the rows in the grid
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 2000 total points
ID: 36602302
Tag={Binding JobID}  assuming that's a member of the class you are binding to
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ChrisMDrew
ID: 36707846
Thanks - that will work perfectly in this situation.  For future reference though - is it possible to get the 'row', bound data object and specific cell value in the code behind handlers?
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 36708637
I am sure, but did not encounter it yet. Perhaps the getrowdefinition() is part of the solution.
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 36708638
I am sure, but did not encounter it yet. Perhaps the getrowdefinition() is part of the solution.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question