Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Windows Mobile - getting a row in a Grid

Posted on 2011-09-26
6
Medium Priority
?
220 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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

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!

Question has a verified solution.

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

With Windows Embedded Handheld, called Windows Mobile, Microsoft re-designed the user interface. The Start Icon moved down to the bottom, inside the menu bar area.   If you need to hide the Start Icon and/or the SIP (soft input panel, softwar…
In this article we will discuss all things related to StageFright bug, the most vulnerable bug of android devices.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

971 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