Solved

Windows Mobile - getting a row in a Grid

Posted on 2011-09-26
6
215 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 500 total points
ID: 36602302
Tag={Binding JobID}  assuming that's a member of the class you are binding to
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Suggested Solutions

Title # Comments Views Activity
disable data migrations in visual studio 2017 4 69
ASP.net Markup for Sub Menu 2 65
Calculating percentage 2 49
Data Analysis 7 59
If you are anything like me, you install many apps on your phone and have your life on it, sometimes literally.  When I bought my current phone, a Samsung Galaxy S5 from Verizon, they were only selling the versions with 16 GB internal.  I didn't rea…
A short article about problems I had with the new location API and permissions in Marshmallow
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
Suggested Courses

751 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