data binding a collection onto a canvas

data binding a collection onto a canvas

Post by Steve Mill » Mon, 24 Mar 2008 10:36:41

I have an ObservableCollection of objects that encode a reference to
an image with left, top, width, and height. I want to data bind them
onto a Canvas in a WPF Window. What I've tried uses:

<DataTemplate x:Key="ImageTemplate">
Source="{Binding Path=Key, Converter={StaticResource
Width="{Binding Path=Width}"
Height="{Binding Path=Height}"

<Canvas.Left><Binding Path=Left" /> </Canvas.Left>
<Canvas.Top><Binding Path=Top" /> </Canvas.Top>


<ListBox Name="Images"
ItemTemplate="{StaticResource ImageTemplate}">
<Canvas />

The images show up on the Canvas just fine, EXCEPT that the left and
top all come out == 0.0. The image file is picked up, the width and
height are fine, but not left and top.

All suggestions welcome.

- Steve

1. Referencing data set B in data step A's DO loop

2. Copy all data from a:Class A's fields to the namesake fields of b:Class B.

I have two class with nearly exactly same attributes, the only difference is
class B's property setter does some argument checking.

class A
private string a;

public string AA
get { return a; }
set { a = value; }

class B
private string a;

public string AA
get { return a; }
if (string.IsNullOrEmpty(value))
throw new ApplicationException();
a = value;

I want to do the following:
A a = new A();
a.AA = "123123";
B b = (B)a; -- Copy a's attribute values to b.
Please tell me how to implement a generic function to support copying
namesake fields from one class instance to another even when they belongs to
different class type.



3. binding canvas item versus binding canvas widget

4. Printing report b after report a prints using report a's variables

5. Why does Form-A's instance fire Form-B's event??

6. using "if" but omitting the #n/a's

7. equation that will filter out #N/A's

8. "Matching" column A's values in column B

9. Formula's with #N/A's

10. How do I only get valid "answers" in a VLOOKUP function (no #N/A's

11. 'Send As' messages stay in User A's sent folder.

12. Scottie A's Hall of Flame

13. CAnnot type lowercAse 'A's Anymore (solved!)

14. lookup only finds #n/a's

15. Try Again / VLOOKUP without N/A's