I reiterate care with using the datagrid, especially if you're using
animations that affect its measure. There's a lot of elements that make
up that sucker, and even on kick @ss CPUs animation can have annoying
little ticks if you're having to push a datagrid around.
Now that animation is becoming so easy, it's very important to consider
how to wield it. Nothing can help more than planning your design up
front.
Hope that's not too Bill Buxton-ish. *grin*
Carl.
From: [email protected]
[mailto:[email protected]] On Behalf Of ross
<[email protected]>
Sent: Tuesday, 13 April 2010 9:25 AM
To: ozSilverlight <[email protected]>
Subject: Re: Row index
This may not be appropriate for you situation of course, but I
remember reading someone's blog that pointed out that (in wpf /
silverlight) the use of a datagrid shouldn't necessarily be an
automatic decision for displaying lists of data.
The alternative being the ItemsControl and ItemTemplate. In some
situations you can create a much more elegant and flexible UI compared
with a grid.
If you don't need the specific benefits of a datagrid, such as column
resizing and reordering, it might be worth ditching the grid
altogether.
PS. You might need to take some care if you are loading lots of rows
into an itemscontrol, in which case some sort of virtualization would
be advisable.
On Tue, Apr 13, 2010 at 10:32 AM, Stephen Price
< [email protected]> wrote:
> It's been working with SelectedItem but I've got what seems to be a
race
> condition between two events and sometimes the selected item is not
correct.
> I'm collapsing all of the detailpanels and then either showing or
hiding the
> detail panel that was just clicked, at the same time as using the
selected
> item to filter the results for a datagrid within the details panel.
the net
> result is that sometimes the wrong row gets the data or worse I end up
with
> a Layout loop (seems to be on the datagrids that have a lot of rows).
>
> I can't use the datacontext from the row as the data is on the
viewmodel
> itself (property uses linq query to filter the results for the row
> selected). I think a better way to do this would be the classic master
> slave, where I have a single grid or list and the selected item
decides what
> to populate in a slave datagrid. that's the behaviour we wanted except
that
> the slave datagrid is show in the row's detail panel (selecting
another row
> via toggle button in another row collapses all other rows and shows
the row
> clicked).
>
> Doesnt explain why expanding some of the larger rows gives me a layout
loop
> exception but that could be a different issue (or maybe even a weird
bug in
> the datagrid?) I know there used to be a limit on the number of
textboxes
> you could show on a page, but I read that was fixed in SL3.
>
> thanks for the replies,
> Stephen
>
> On Mon, Apr 12, 2010 at 8:38 PM, Miguel Madero < [email protected]>
wrote:
>>
>> Stephen,
>>
>> Could you provide more details about it? An example of the collection
of
>> itemssources. The Details Panel already has the same DataContext as
the row.
>> I don't understand what you want to do? Is it just a child colleciton
and
>> for some reason you want it to use the same index as the parent row?
>>
>> Could the VisualTreeHelper or a Converter help?
>>
>> On Mon, Apr 12, 2010 at 8:56 PM, ross < [email protected]> wrote:
>>>
>>> Maybe you need to take a different approach.
>>>
>>> You could bind the SelectedItem property of the grid to an
appropriate
>>> property on whatever class is supplying your ItemsSource /
>>> datacontext, depending on how you have it coded. Your details panel
>>> could bind to the same property as well, or if it is more complex
you
>>> could use it as a hook to do what ever you need, such as update
>>> whatever it is your details panel binds against in the setter
perhaps.
>>>
>>> Another, less elegant option is to handle the SelectionChanged event
>>> of the grid and then use the SelectionChangedEventArgs.AddedItems
>>> property to give you a hook as to what the new selected item is,
which
>>> can then be used to set the datacontext of your details panel.
>>>
>>>
>>> On Mon, Apr 12, 2010 at 7:45 PM, Stephen Price <
[email protected]>
>>> wrote:
>>> > Hey all,
>>> > Will someone put me out of my misery and tell me how I can easily
get
>>> > the
>>> > index of a row in a datagrid? I can't believe there's no way to
iterate
>>> > through the rows in a datagrid. Have been banging my head against
a
>>> > wall all
>>> > afternoon and I'm done.
>>> > What I actually want to do is set the datacontext of each Details
panel
>>> > of
>>> > my datagrid (more specifically another datagrid within each
>>> > detailpanel) to
>>> > the same index item as the row. ie collection of itemsources with
each
>>> > itemsource being set to the collection[index] that matches that
row's
>>> > index.
>>> > hopefully that makes sense to someone.
>>> > thanks :)
>>> > Stephen
>>> > _______________________________________________
>>> > ozsilverlight mailing list
>>> > [email protected]
>>> > http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>> >
>>> >
>>> _______________________________________________
>>> ozsilverlight mailing list
>>> [email protected]
>>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>>
>>
>> --
>> Miguel A. Madero Reyes
>> www.miguelmadero.com (blog)
>> [email protected]
>>
>> _______________________________________________
>> ozsilverlight mailing list
>> [email protected]
>> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>>
>
>
> _______________________________________________
> ozsilverlight mailing list
> [email protected]
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
>
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
________________________________________________________________________
_______
This email has been scanned by the Bankwest Email Security System.
________________________________________________________________________
_______
_______________________________________________________________________________
Unencrypted electronic mail is not secure and may not be authentic.
If you have any doubts as to the contents please telephone to confirm.
This electronic transmission including any attachments is intended only
for those to whom it is addressed. It may contain copyright material or
information that is confidential, privileged or exempt from disclosure by law.
Any claim to privilege is not waived or lost by reason of mistaken transmission
of this information. If you are not the intended recipient you must not
distribute or copy this transmission and should please notify the sender.
Your costs for doing this will be reimbursed by the sender.
We do not accept liability in connection with computer virus, data corruption,
delay, interruption, unauthorised access or unauthorised amendment.
_______________________________________________________________________________
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
ozsilverlight mailing list
[email protected]
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight