![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
| |
| | #1 (permalink) |
| | 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) |
| | 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) |
| | 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 | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Some Control Panel items have gone missing | Vista General | |||
| missing items at control panel | General Discussion | |||
| cannot access certain control panel items | Vista General | |||
| Remove items from Control Panel? | Vista General | |||
| Can't open items in control panel | Vista account administration | |||