![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Databinding a list of items into a panel I am databinding a list of items into an ItemsControl. I want each item to have a specific position on the screen (which would be - ideally - databound). So I changed the ItemsPanel to a Canvas. It works perfectly if I don't use the databound version (i.e., if I simply write items down inside the ItemsControl). But if I use the ItemsSource property, the Canvas.Top property seems to be ignored (all items are displayed at 0)! The relevant code fragment is below: <UserControl x:Class="Octgn.Play.Gui.TableControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:gui="clr-namespace:MyNamespace.Gui"> <UserControl.Resources> <DataTemplate x:Key="CardTemplate"> <gui:CardControl Canvas.Top="30" /> </DataTemplate> </UserControl.Resources> <ItemsControl x:Name="presenter" ItemsSource="{Binding Cards}" ItemTemplate="{StaticResource CardTemplate}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Canvas /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </UserControl> I've spent a huge amount of time trying to get this to work, without success so far. So thank you very much if you can tell me what's wrong with it. |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Databinding a list of items into a panel See http://www.i-constructions.com/myblo...tabinding.html Hope this helps. -- Valentin Iliescu [MVP - Client Application Development] "jods" wrote: > I am databinding a list of items into an ItemsControl. I want each item to > have a specific position on the screen (which would be - ideally - > databound). So I changed the ItemsPanel to a Canvas. > > It works perfectly if I don't use the databound version (i.e., if I simply > write items down inside the ItemsControl). But if I use the ItemsSource > property, the Canvas.Top property seems to be ignored (all items are > displayed at 0)! > > The relevant code fragment is below: > > <UserControl x:Class="Octgn.Play.Gui.TableControl" > xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" > xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > xmlns:gui="clr-namespace:MyNamespace.Gui"> > > <UserControl.Resources> > <DataTemplate x:Key="CardTemplate"> > <gui:CardControl Canvas.Top="30" /> > </DataTemplate> > </UserControl.Resources> > > <ItemsControl x:Name="presenter" ItemsSource="{Binding Cards}" > ItemTemplate="{StaticResource CardTemplate}"> > <ItemsControl.ItemsPanel> > <ItemsPanelTemplate> > <Canvas /> > </ItemsPanelTemplate> > </ItemsControl.ItemsPanel> > </ItemsControl> > > </UserControl> > > I've spent a huge amount of time trying to get this to work, without success > so far. So thank you very much if you can tell me what's wrong with it. |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: Databinding a list of items into a panel Thanks for the quick answer! My google-fu is too weak apparently, because I've looked for such a post but didn't find anything useful... This blog explains and solves exactly the problem that I'm experiencing. Regards, jods |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| cannot access certain control panel items | pvt_pilot | Vista General | 0 | 01-22-2008 09:26 PM |
| Remove items from Control Panel? | Brian Wescombe | Vista General | 3 | 01-03-2008 10:18 AM |
| Recent items list | KRK | Vista General | 5 | 12-02-2007 06:05 AM |
| My Control Panel items have disappeared | Steven Hanson | Vista General | 6 | 10-12-2007 01:20 AM |
| Can't open items in control panel | elundquist | Vista account administration | 1 | 01-02-2007 10:52 AM |