私は、ユーザーがWPFでさまざまな機能を持つモジュールを使用して簡単なプログラムを設計できるようにするプログラムを作成しようとしています。とにかくWPF - カスタムコントロール間の線をプログラムで描画する方法
<Border Height="75" Width="150" BorderThickness="1" BorderBrush="Black">
<Grid Background="Gray" Height="75" Width ="150">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="2*"/>
</Grid.RowDefinitions>
<Label Content="Double" FontSize="12" Grid.Row="0" HorizontalContentAlignment="Center" Background="Aquamarine"/>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Button Name="IncomingConnection" Height="15" Width="15" Background="Black" Margin="5" VerticalAlignment="Top" HorizontalAlignment="Left"/>
<Button Name="OutgoingConnection" Grid.Column="2" Height="15" Width="15" VerticalAlignment="Top" Background="Black" Margin="5" HorizontalAlignment="Right"/>
<Button Name="OutgoingData" Grid.Column="2" Height="15" Width="15" VerticalAlignment="Bottom" Background="Aquamarine" Margin="5" HorizontalAlignment="Right"/>
</Grid>
</Grid>
</Border>
が、私はこれらのボタン(incomingConnectionまたはoutgoingConnection)のいずれかをクリックして、ラインが接続持ってできるようにしたい:
私はこのように私のモジュールのためのカスタムコントロールを作成しました2つのボタン。
その他の情報:カスタムコントロールはすべて親指の内側に配置されているため、ドラッグすることができます。すべてがキャンバス上にあります。私はコントロール間の線を作成するのではなく、コントロールのボタンの間に線を作成したい。
ありがとうございます!
あなたは何を試しましたか?いくつかの[コマンド](http://stackoverflow.com/questions/7660547/how-to-create-bindable-commands-in-custom-control)を実装しましたか? –
ほとんどの研究だけで、私が見つけたことは、コントロール全体に排他的であると思われ、その特定のボタンではないようです。私はそれが押されたときにボタンのポイントを得ようとしましたが、コントロールが他の場所にドラッグされても機能しませんでした。 –