Click here to Skip to main content
15,892,737 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: XAML Power Toys Released Pin
Pete O'Hanlon7-Sep-08 9:35
mvePete O'Hanlon7-Sep-08 9:35 
AnswerRe: XAML Power Toys Released Pin
Paul Conrad3-Sep-08 11:48
professionalPaul Conrad3-Sep-08 11:48 
AnswerRe: XAML Power Toys Released Pin
Sk8tz13-Sep-08 14:30
professionalSk8tz13-Sep-08 14:30 
GeneralRe: XAML Power Toys Released Pin
Pete O'Hanlon14-Sep-08 8:42
mvePete O'Hanlon14-Sep-08 8:42 
GeneralRe: XAML Power Toys Released Pin
Sk8tz14-Sep-08 22:02
professionalSk8tz14-Sep-08 22:02 
GeneralRe: XAML Power Toys Released Pin
Pete O'Hanlon14-Sep-08 22:37
mvePete O'Hanlon14-Sep-08 22:37 
GeneralRe: XAML Power Toys Released Pin
User 27100922-Sep-08 3:39
User 27100922-Sep-08 3:39 
QuestionImage control can't render BitmapSource/InteropBitmap Pin
brafales30-Aug-08 3:13
brafales30-Aug-08 3:13 
Hi,

I'm building a simple application in which I want to render a "thumbnail" of the clipboard data if that data is an Image. I've managed to do everything right (as far as I know) but the Image control of the Window doesn't render correctly the contents of the BitmapSource.

Here is the XAML of the Window:

<Window x:Class="ClipboardTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" SizeToContent="WidthAndHeight">
<StackPanel Margin="10">
<Image MaxHeight="200" MaxWidth="300" x:Name="ImagePreview" Margin="10"></Image>
<Button x:Name="ButtonCapture" Click="ButtonCapture_Click" MinWidth="75" Margin="10">Capture Clipboard Data</Button>
</StackPanel>
</Window>

And here is the code of the code behind file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ClipboardTest
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}

private void ButtonCapture_Click(object sender, RoutedEventArgs e)
{
if (Clipboard.ContainsImage())
{
BitmapSource source = Clipboard.GetImage();
ImagePreview.Source = source;
}
}
}
}

To test it just run the program, then press Print Screen (or copy just any image from paint) and then click on the button. As you'll see, the image gets actually rendered because the Image control resizes accordingly (note the maximum values so if you Print Screen it will just resize to 300x200). BUT the actual contents of the image are not rendered, the image is simply blank. I don't know what I'm doing wrong. I've noticed that altough the documentation states that Clipboard.GetImage(); returns a BitmapSource, the actual object I get when debugging is an InteropBitmap. I don't know if this has anything to do with it.

Any ideas on how to get the source of the ClipboardData (and actually any bitmapsource/interopbitmap) get rendered well on a default WPF Image control?

Many thanks!
AnswerRe: Image control can't render BitmapSource/InteropBitmap Pin
Insincere Dave30-Aug-08 7:51
Insincere Dave30-Aug-08 7:51 
GeneralRe: Image control can't render BitmapSource/InteropBitmap Pin
brafales31-Aug-08 9:28
brafales31-Aug-08 9:28 
QuestionWPF Textbox validation? Pin
Dotnetkanna30-Aug-08 1:44
Dotnetkanna30-Aug-08 1:44 
AnswerRe: WPF Textbox validation? Pin
Pete O'Hanlon30-Aug-08 9:02
mvePete O'Hanlon30-Aug-08 9:02 
QuestionWPF D3DImage performs good on XP, bad on Vista [modified] Pin
Dave_BHGF29-Aug-08 7:29
Dave_BHGF29-Aug-08 7:29 
QuestionInteresting WPF Info Pin
Jammer28-Aug-08 23:05
Jammer28-Aug-08 23:05 
AnswerRe: Interesting WPF Info Pin
Pete O'Hanlon29-Aug-08 0:55
mvePete O'Hanlon29-Aug-08 0:55 
GeneralRe: Interesting WPF Info Pin
Jammer29-Aug-08 1:52
Jammer29-Aug-08 1:52 
QuestionHow to enable Context menu for a listbox item. Pin
Aslesh28-Aug-08 17:31
Aslesh28-Aug-08 17:31 
AnswerRe: How to enable Context menu for a listbox item. Pin
User 27100931-Aug-08 16:18
User 27100931-Aug-08 16:18 
GeneralRe: How to enable Context menu for a listbox item. Pin
Aslesh31-Aug-08 20:04
Aslesh31-Aug-08 20:04 
GeneralRe: How to enable Context menu for a listbox item. Pin
User 2710091-Sep-08 5:35
User 2710091-Sep-08 5:35 
GeneralRe: How to enable Context menu for a listbox item. Pin
Aslesh1-Sep-08 5:49
Aslesh1-Sep-08 5:49 
AnswerRe: How to enable Context menu for a listbox item. [modified] Pin
Pete O'Hanlon1-Sep-08 9:45
mvePete O'Hanlon1-Sep-08 9:45 
GeneralRe: How to enable Context menu for a listbox item. Pin
Aslesh2-Sep-08 10:20
Aslesh2-Sep-08 10:20 
GeneralRe: How to enable Context menu for a listbox item. Pin
Pete O'Hanlon2-Sep-08 10:25
mvePete O'Hanlon2-Sep-08 10:25 
GeneralRe: How to enable Context menu for a listbox item. Pin
Aslesh2-Sep-08 10:35
Aslesh2-Sep-08 10:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.