[C# WPF] 복사하기 버튼을 통해 복사하기

728x90

 

    <Grid Background="White">
				...
            <TextBox Grid.Row="1" Name="QueryContent" Text="테스트입니다." Padding="5 5 5 5" Margin="3 3 10 3"/>
				...
                <Button Grid.Column="2" Width="120" Height="30" HorizontalAlignment="Right" Margin="3 3 10 3" Click="CopyButtonClick"> 복사하기</Button>
            </Grid>
        </Grid>
    </Grid>
</UserControl>

 

        private void CopyButtonClick(object sender, RoutedEventArgs e)
        {
            Clipboard.SetText(QueryContent.Text);
            MessageBox.Show("복사 되었습니다.");

        }

 

728x90