Hello,
I want to build a module with diagram,
in this module,I have two custom shape with textbox and button in the shape ContentTemplate.each shape provide 20 ToolboxItem,I want to achieve the goal when I input text to a textbox or click a button in the diagram,I want to get the text of the textbox or the which button was clicked.
the problem is:
1.in the diagram, there are 20 textbox/button ToolboxItem, how to binding a Property to the textbox/button let me know each textbox's text and which button was clicked.
2.can we binding a DependencyProperty to the textbox or button, and the mode is twoway?
I have looked the Dashboard simple,but I have no idea about this requirement.
Here is the pivotal code:
GenericShapes.xaml:
<Style TargetType="dashboard:TextBoxShape">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="40" />
<Setter Property="MaxWidth" Value="400" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<telerik:RadWatermarkTextBox MinWidth="90" MaxWidth="400" LostFocus="ChangeValue"/>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="dashboard:ButtonShape">
<Setter Property="Foreground" Value="Black" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
<Setter Property="Width" Value="120" />
<Setter Property="Height" Value="40" />
<Setter Property="MaxWidth" Value="400" />
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Button></Button>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
ToolboxControl.xaml:
<local:TextBoxToolboxItem Header="t1" />
<local:TextBoxToolboxItem Header="t2" />
<local:ButtonToolboxItem Header="b1" />
<local:ButtonToolboxItem Header="b2" />
……