Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Generic button generation for WPF control that hands over control identifier

$
0
0

Hi,

I am displaying a versioning tree of documents, using WPF. I display missing and available documents and would like the user to be able to open the existing documents. Each missing and existing document is represented by vertex defined as follows:

<DataTemplate x:Key="demoTemplate" DataType="{x:Type local:DDNAVertex}"><StackPanel Orientation="Horizontal" Margin="5"><TextBlock Text="{Binding Path=ID, Mode=OneWay}" Foreground="White" /></StackPanel><DataTemplate.Triggers><DataTrigger Binding="{Binding exists}" Value="true">                   </DataTrigger></DataTemplate.Triggers></DataTemplate><Style TargetType="{x:Type graphsharp:VertexControl}"><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type graphsharp:VertexControl}"><Border BorderBrush="White" 
                                    Background="Black"
							        BorderThickness="2"
							        CornerRadius="10,10,10,10"
							        Padding="{TemplateBinding Padding}"><StackPanel Orientation="Vertical"><Expander IsExpanded="True"><ContentPresenter Content="{TemplateBinding Vertex}" 
                                            ContentTemplate="{StaticResource demoTemplate}"/></Expander><Button Content="open" Width="150" Height="25" Margin="5" Click="Button_Click"/></StackPanel><Border.Effect><DropShadowEffect BlurRadius="2" Color="LightGray" 
                                    Opacity="0.3" Direction="315"/></Border.Effect></Border></ControlTemplate></Setter.Value></Setter></Style>

I would like to do two things:

1) Hide the button if exists=false

2) Hand over DDNAVertex.ID to Button_Click

I just started using WPF, so any help on this would be greatly appreciated.
Thanks,

Michael


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>