Wpf-button-Daten-trigger

ich habe eine Schaltfläche in meiner wpf-Formular und der button ist unter dem Bild text in mvvm-Anwendung, wenn ich auf die Schaltfläche klicke wird die Datei anzuhängen, meine Forderung ist es, wenn es erfolgreich angefügt will ich entfernen das Bild vom button und aktualisieren möchten, müssen Sie die Schaltfläche mit text.

 <StackPanel Grid.Row="3" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button ToolTip="Attach Approval" 
                    Height="25" 
                    Command="{Binding AddAttachmentCommand}" 
                    Margin="5,10,5,10">
                <StackPanel Orientation="Horizontal">
                    <Image Source="/UILibrary;component/Themes/Default/Images/Attach.PNG"/>
                </StackPanel>
                <Button.Style>
                    <Style TargetType="{x:Type Button}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding IsAttachmentAvailable}" Value="True">
                                <Setter Property="Visibility" Value="Visible"/>
                                <Setter Property="Content" Value="Appprove"/>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding IsAttachmentAvailable}" Value="False">
                                <Setter Property="Visibility" Value="Visible"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>

            </Button>
            <StackPanel Orientation="Horizontal" 
                        Height="25"  
                        Margin="5,10,5,10"
                        Visibility="{Binding IsAttachmentAvailable, Converter={StaticResource BooleanToVisibilityConverter}}">              
                <TextBlock Margin="3">
                    <Hyperlink Command="{Binding OpenAttachmentCommand}"> 
                        <TextBlock Text="{Binding Attachment.FileName}"/>
                    </Hyperlink>
                </TextBlock>
                <customControls:CloseButton Width="15" Height="15" Command="{Binding RemoveAttachmentCommand}">
                    <customControls:CloseButton>
                        Remove attachment
                    </customControls:CloseButton>
                </customControls:CloseButton>
            </StackPanel>
            <Button Height="25" 
                    Width="80" 
                    Margin="5,10,5,10"
                    Content="Approve" 
                    Command="{Binding ApproveTemplateCommand}"/>
            <Button Height="25" 
                    Width="80" 
                    Margin="5,10,5,10"
                    Content="Preview" 
                Command="{Binding PreviewTemplateCommand}"/>
            <Button Content="Save" 
                Command="{Binding SaveTemplateCommand}" 
                Height="25"
                    Width="80"                    
                    Margin="5,10,5,10"/>
            <Button Height="25"
                    Width="80"
                    Margin="5,10,10,10"
                    Content="Cancel"
                    Command="{Binding CancelCommand}"/>
        </StackPanel>    
InformationsquelleAutor user3089816 | 2015-05-19
Schreibe einen Kommentar