473,395 Members | 1,457 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

RE: WPF: Use MultiBinding to bind end of line to a thumb

Hi George,

I have downloaded your sample project and built it on my machine. When I
start the application and click the Button on the window, I get an
InvalidCastException on the line of code "double topLeft =
(double)values[0];" in the Convert method within the LineBindingConverter
class.

I look into the parameter "values" and find the first element in it is of
type DependencyProperty.UnsetValue. Open the source code of the Window1 and
I find the reason that causes this error, i.e. the Thumb class doesn't have
a Left or Top property. They are attached properties of Canvas.

Modify the two lines of code in the BindLine method as follows and the
problem should be solved:

// bindingX.Path = new PropertyPath("Left");
bindingX.Path = new PropertyPath("(Canvas.Left)");
// bindingY.Path = new PropertyPath("Top");
bindingY.Path = new PropertyPath("(Canvas.Top)");

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 2 '08 #1
1 3171
Linda, Thank you very much. That was it!
"Linda Liu[MSFT]" <v-****@online.microsoft.comwrote in message
news:iM**************@TK2MSFTNGHUB02.phx.gbl...
Hi George,

I have downloaded your sample project and built it on my machine. When I
start the application and click the Button on the window, I get an
InvalidCastException on the line of code "double topLeft =
(double)values[0];" in the Convert method within the LineBindingConverter
class.

I look into the parameter "values" and find the first element in it is of
type DependencyProperty.UnsetValue. Open the source code of the Window1
and
I find the reason that causes this error, i.e. the Thumb class doesn't
have
a Left or Top property. They are attached properties of Canvas.

Modify the two lines of code in the BindLine method as follows and the
problem should be solved:

// bindingX.Path = new PropertyPath("Left");
bindingX.Path = new PropertyPath("(Canvas.Left)");
// bindingY.Path = new PropertyPath("Top");
bindingY.Path = new PropertyPath("(Canvas.Top)");

Please try my suggestion and let me know the result.

Sincerely,
Linda Liu
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bob Lehmann | last post by:
Hi, I'm trying to bind an ArrayList to a DataList. I get the error DataBinder.Eval: 'System.String' does not contain a property with the name Name. I don't know what property of ArrayList...
4
by: moondaddy | last post by:
I'm trying to databind a dependency property in a custom control (CenterX) to the Line.X1Property property of line. If I can correctly do this (and the same for the 'Y' props) then when I drag my...
6
by: moondaddy | last post by:
I'm writing a windows app in WPF and want to change the shape of a thumb to an ellipse. Is this possible? also, the edges of the thumb are beveled. Is it possible to change this to a flat look...
2
by: moondaddy | last post by:
I'm trying to do something real simple. Add a thumb to a grid at the end of a line using c#. the code executes but I dont see the thumb. Can anyone explain what and what I need to do to properly...
2
by: moondaddy | last post by:
I'm creating a sample project where I will adorn a Polyline with thumbs so I can resize it by dragging its ends (and points) around. This is similar to some projects I've posted using a...
3
by: moondaddy | last post by:
I have a windows WPF sample project which is starting to work pretty good. I can drag shapes and lines, and connect a straight line to any place on a custom rectangle shape's boarder. Now I have a...
0
by: =?Utf-8?B?YWxleF9jYXJvMQ==?= | last post by:
Hi, I would like to use a multibinding to determine the fill value of my rectangle style. <Style x:Key="StyleRect" TargetType="{x:Type Rectangle}"> <Setter Property="Fill"> <Setter.Value>...
1
by: Linda Liu[MSFT] | last post by:
Hi George, Thank you for posting! This is a quick note to let you know that I am doing research on this issue and will get back to you ASAP. I appreciate your patience! Sincerely,
0
by: Chris Jobson | last post by:
>I have a sample similar to a previous post where I was binding a line end Not sure if I'm right, but I think the problem is that the data binding doesn't go through the property wrapper, but...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.