This is a migrated thread and some comments may be shown as answers.

Diagram Shapes w/Data TextBox dependency property

1 Answer 34 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 10 Apr 2013, 04:06 PM
Hi Everyone,

I have a custom shape (PropertyShape.cs).
Inside that Shape I have a LINQ Query in the PropertyShape_Load event

My LINQ query is something like this:

var query = from c in ctx.new_propertySet where (c.new_PropertyNumber == "1234")
select c;

This works as intended.

What I would like to do, is add a custom control (textbox w/button) to the MainPage.xaml page.
The TextBox.Text would then pass to PropertyShape.cs and update the "1234" which would be a dependency property named PropNo.

I've been working on this, google searching, telerik forums, etc, just can't can't get it to work. I would appreciate some help at least to get me going in the right direction. Thank you for your patience in advance!

1 Answer, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 15 Apr 2013, 12:09 PM
Hello Michael,

Unfortunately I am not sure if I understand your requirements properly. Can you please elaborate a bot more on your scenario. Specifically, I'm wondering if the PropertyShape class derives from RadDiagramShape(RadDiagramShapeBase) classes? Also, do you have a single RadDiagram in your MainPage? And in that diagram do you have only one shape of type PropertyShape? How do you create the shape - is it defined in xaml, code-behind or via databinding?

If your layout includes a declaratively defined RadDiagram with a single RadDiagramShape of type PropertyShape, then you can use a couple of approaches to define the "1234" number. You can create a MainViewModel that has a PropNumber property. Then you can bind both the TextBox.Text property and the PropertyShape.PropNo properties to the business MainViewModel PropNumber property. And as long as you use a TwoWay binding for the TextBox.Text, you will be able to dynamically update the value of the MainViewModel PropNumber thus updating the PropertyShape.PropNo.

However, if you have different shapes and each shape should represent a different property with different number, then a better approach might be to consider using a collection of business items to populate the RadDiagram.GrapghSource property. We have a few articles that can give you more info on such an approach:

I hope this information will help you. Still, please write back if you have any further information that can help us better grasp your idea and we'll gladly assist you implement your scenario.


Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
Diagram
Asked by
Michael
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Share this question
or