TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tadek
NA
5
5.3k
absolute position(x,y) of ListBoxItem - Binding self , IValueConverter and TransformToVisual - is it possible?
Mar 8 2011 11:38 AM
Hi,
I'm trying something like this:
....
<DataTemplate...>
....
<TextBlock Text="{Binding RelativeSource={RelativeSource Self}, Converter={StaticResource PositionConverter}}" />
and
class Position : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
GeneralTransform generalTransform =
value
.TransformToVisual(null); //
here I get error
Point point = generalTransform.Transform(new Point());
return "X="+Point.X+"Y="+Point.Y;
}
....
and the result is following error:
'object' does not contain a definition for 'TransformToVisual' and no extension method 'TransformToVisual' accepting a first argument of type 'object' could be found
Any ideas how to solve this, or maybe some one know different approach to get absolute position of listbox elements?
Regards,
Tadek.
Reply
Answers (
4
)
How to write code for window close button
Animation to change background image of window