Solved

Windows Mobile - getting a row in a Grid

Posted on 2011-09-26
6
200 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
Comment Utility
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
Comment Utility
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
Comment Utility
Tag={Binding JobID}  assuming that's a member of the class you are binding to
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

Author Comment

by:ChrisMDrew
Comment Utility
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
Comment Utility
I am sure, but did not encounter it yet. Perhaps the getrowdefinition() is part of the solution.
0
 
LVL 48

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now