Monotouch.Dialog IS a UITableViewController and hence also has a UITableView, 
so you should be apply to use this solution 1:1.

René

-----Ursprüngliche Nachricht-----
Von: Guido Van Hoecke [mailto:gui...@gmail.com] 
Gesendet: Montag, 4. Juni 2012 13:49
An: Craig Dunn
Cc: monotouch@lists.ximian.com; René Ruppert; Miguel de Icaza
Betreff: Re: [MonoTouch] How to keep selected (element)row highlighted

Craig,

Unfortunately, MWC does not use Monotouch.Dialog: it uses its own UITableView 
which gives a finer control over things.

My Master is a DialogViewController, which is also available on the iPhone with 
some minor conditional stuff, mostly to differentaite between the iPhone and 
iPad paradigm.

I can highlight the entry at NSIndexParth.FromRowSection(0,0) at initial 
loading time, but fail to keep the selection highlighted whenever an entry is 
tapped.

Here's what I've got to handle this:

* in the Dialog Constructor:

if (AppDelegate.IsPad)
        Dvc.OnSelection += DvcOnOnSelection;

* and the DvcOnSelection method:

private void DvcOnOnSelection(NSIndexPath nsIndexPath) {
        Dvc.TableView.SelectRow(
                Dvc.TableView.IndexPathForSelectedRow,
                true,
                UITableViewScrollPosition.None);
}

This method is called whenever a row is tapped, but it does not preserve nor 
force the selection color.

Any ideas to preserve the selected color in Monotouch.Dialog?
It would be a pity if I had to recode the existing iPhone controller as a lower 
level TableViewController on the Ipad...

Thanks in advance,

Guivho.




On 3 June 2012 23:58, Craig Dunn <craig.d...@gmail.com> wrote:
> The MWC sample does that - both for the master list (landscape view) 
> and also the mini 'speaker list' for sessions that you can see in this 
> screenshot.
> https://raw.github.com/xamarin/mobile-samples/master/MWC/Screenshots/i
> OS/Sessions_iPad.PNG
>
> the relevant pieces of code are :
> * in the SpeakersTableViewSource.cs, we DON'T deselect, so the blue 
> highlight will remain
>
> if (AppDelegate.IsPhone) tableView.DeselectRow (indexPath, true);
>
>
>
> * in SessionView.cs we set the selection to a particular row when 
> loading
>
> if (AppDelegate.IsPad) {
>
> // set the highlight for whatever speaker is showing in the other 
> column (only iPad, obviously)
>
>    if (speakerTable.IndexPathForSelectedRow == null)
>
>       speakerTable.SelectRow (NSIndexPath.FromRowSection (0,0), true, 
> UITableViewScrollPosition.Top);
>
>    else
>
>       speakerTable.SelectRow (speakerTable.IndexPathForSelectedRow, 
> true, UITableViewScrollPosition.Top);
>
>
> HTH
> craig
>
>
> On Sun, Jun 3, 2012 at 10:38 PM, Guido Van Hoecke <gui...@gmail.com> wrote:
>>
>> Hi,
>>
>> I'm working at a universal app where I use the wonderfull 
>> MTSplitViewController when ran on the iPad (Thank you René).
>>
>> Both Master and Detail panes use DialogViewControllers (Thank you 
>> Miguel).
>>
>> Selecting an element on the Master creates and pushes the 
>> corresponding DialogController onto the UINavigationController 
>> associated with the Detail pane.
>>
>> This interaction works like a charm!
>>
>> When I tap an element in the Master pane, the blue selection bar 
>> fades out, which is the normal expected behaviour. However, for a 
>> Master pane it would be desirable that this selection color would not 
>> diappear, leaving a clear trace of the selected option that 
>> corresponds to the current Detail pane content, as a kind of the 'Active 
>> menu choice'.
>>
>> I dare hope that this can be easily achieved, but I've 
>> stackoverflowed and googled around without success.
>>
>> Any ideas or suggestions?
>>
>> Thanks in advance,
>>
>>
>> Guido
>>
>> --
>> You will be surprised by a loud noise.
>>
>> http://vanhoecke.org ... and go2 places!
>> _______________________________________________
>> MonoTouch mailing list
>> MonoTouch@lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/monotouch
>
>

_______________________________________________
MonoTouch mailing list
MonoTouch@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to