Solved

Windows Mobile - getting a row in a Grid

Posted on 2011-09-26
6
216 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
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

As the title indicates, I have done this before. It chills me everytime I update the OS on my phone, (http://www.experts-exchange.com/articles/18084/Upgrading-to-Android-5-0-Lollipop.html) because one time I did this and I essentially had a bricked …
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

622 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