Click here to Skip to main content
15,891,607 members
Home / Discussions / WPF
   

WPF

 
Questionrandom image appear Pin
yuripon3-May-10 15:32
yuripon3-May-10 15:32 
AnswerRe: random image appear Pin
Kunal Chowdhury «IN»9-May-10 0:40
professionalKunal Chowdhury «IN»9-May-10 0:40 
QuestionWPF Browser Application Error - System.ArgumentException: Value does not fall within the expected range. Pin
Polymorpher3-May-10 14:38
Polymorpher3-May-10 14:38 
AnswerRe: WPF Browser Application Error - System.ArgumentException: Value does not fall within the expected range. Pin
prabhu_thil23-Nov-10 7:16
prabhu_thil23-Nov-10 7:16 
QuestionWriteableBitmap problem Pin
#realJSOP3-May-10 2:54
mve#realJSOP3-May-10 2:54 
AnswerRe: WriteableBitmap problem Pin
Rama Krishna Vavilala3-May-10 4:34
Rama Krishna Vavilala3-May-10 4:34 
GeneralRe: WriteableBitmap problem Pin
#realJSOP3-May-10 5:06
mve#realJSOP3-May-10 5:06 
AnswerRe: WriteableBitmap problem Pin
42774803-May-10 10:27
42774803-May-10 10:27 
Hi John,

I wrote this very quick and it seems to work just fine. The only thing is that you need to click the button twice!! That I dont know why?

XAML
<UserControl x:Class="SilverlightApplication5.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input">
    <UserControl.Resources >
        <Style x:Key="TitleBaseStyle" TargetType="dataInput:Label">
            <Setter Property="Width" Value="60" />
            <Setter Property="Height" Value="30" />
            <Setter Property="Background" Value="Black" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="FontSize" Value="17" />
            <Setter Property="Padding" Value="0" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="HorizontalContentAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
        </Style>

    </UserControl.Resources>

        <Grid x:Name="LayoutRoot" Background="White">
        <Button Content="Button" Height="23" HorizontalAlignment="Left" Margin="156,190,0,0" Name="button1" VerticalAlignment="Top" Width="75" Click="button1_Click" />
        <dataInput:Label Style="{StaticResource TitleBaseStyle}" Height="23" HorizontalAlignment="Left" Margin="81,190,0,0" Name="label1" VerticalAlignment="Top" Width="57"/>
        <Image Height="91" HorizontalAlignment="Left" Margin="137,93,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="110" />
    </Grid>
</UserControl>


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Media.Imaging;

namespace SilverlightApplication5
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            label1.Content = "WHMC";
            WriteableBitmap bmp = new WriteableBitmap(60, 60);
            bmp.Render(label1, new RotateTransform() { Angle = 0 });
            bmp.Invalidate();

            image1.HorizontalAlignment = HorizontalAlignment.Center;
            image1.VerticalAlignment = VerticalAlignment.Center;
            image1.Width = bmp.PixelWidth;
            image1.Height = bmp.PixelHeight;
            image1.Source = bmp;
        }
    }
}

GeneralRe: WriteableBitmap problem Pin
42774803-May-10 11:11
42774803-May-10 11:11 
GeneralRe: WriteableBitmap problem Pin
Tim Yen3-May-10 14:57
Tim Yen3-May-10 14:57 
AnswerRe: WriteableBitmap problem Pin
#realJSOP4-May-10 7:54
mve#realJSOP4-May-10 7:54 
QuestionRTF Encoding Pin
Adriaan Davel3-May-10 2:09
Adriaan Davel3-May-10 2:09 
AnswerRe: RTF Encoding Pin
Abhinav S3-May-10 5:13
Abhinav S3-May-10 5:13 
GeneralRe: RTF Encoding Pin
Adriaan Davel3-May-10 18:56
Adriaan Davel3-May-10 18:56 
QuestionEvent calendar Pin
Peace ON3-May-10 0:53
Peace ON3-May-10 0:53 
AnswerRe: Event calendar Pin
Abhinav S3-May-10 5:09
Abhinav S3-May-10 5:09 
AnswerRe: Event calendar Pin
Peace ON3-May-10 21:18
Peace ON3-May-10 21:18 
QuestionWPF: Context-menu for Row and Header of DataGrid Pin
Prasoon Chaudhary2-May-10 20:34
Prasoon Chaudhary2-May-10 20:34 
AnswerRe: WPF: Context-menu for Row and Header of DataGrid Pin
Prasoon Chaudhary2-May-10 21:22
Prasoon Chaudhary2-May-10 21:22 
GeneralRe: WPF: Context-menu for Row and Header of DataGrid Pin
Pete O'Hanlon3-May-10 2:41
mvePete O'Hanlon3-May-10 2:41 
QuestionCustom SelectedItem in ListView Pin
Saksida Bojan1-May-10 9:30
Saksida Bojan1-May-10 9:30 
AnswerRe: Custom SelectedItem in ListView Pin
Pete O'Hanlon1-May-10 9:45
mvePete O'Hanlon1-May-10 9:45 
GeneralRe: Custom SelectedItem in ListView Pin
Saksida Bojan1-May-10 10:39
Saksida Bojan1-May-10 10:39 
GeneralRe: Custom SelectedItem in ListView Pin
Pete O'Hanlon1-May-10 10:40
mvePete O'Hanlon1-May-10 10:40 
GeneralRe: Custom SelectedItem in ListView Pin
Saksida Bojan1-May-10 10:59
Saksida Bojan1-May-10 10:59 

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.