Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

SilverLight dinamički images

[es] :: .NET :: WPF Programiranje :: SilverLight dinamički images

[ Pregleda: 3169 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

artriba
Split

Član broj: 158342
Poruke: 109
*.adsl.net.t-com.hr.



Profil

icon SilverLight dinamički images01.05.2008. u 17:05 - pre 194 meseci
Nemogu dinamički dodati image.
Evo XAML
Code:
<UserControl x:Class="Silverlight_GO.Page"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas x:Name="imCan" >
            <TextBox x:Name="tb1" Height="20" Width="100"/>
            <TextBlock Height="20" Width="100" Text="OK" Canvas.Left="0" Canvas.Top="20" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"/>
        </Canvas>
    </Grid>
</UserControl>

Evo i metode TextBlock_MouseLeftButtonDown koja bi trebala dodat image
Code:
namespace Silverlight_GO
{
    public partial class Page : UserControl
    {
        public Page ()
        {
            InitializeComponent ();
        }

        private void TextBlock_MouseLeftButtonDown ( object sender, MouseButtonEventArgs e )
        {
            ( sender as TextBlock ).Text = "bLA";//ovo je samo primjer da metoda radi ali image se ne dodaje
            Image myImage = new Image ();
            myImage.Source = new BitmapImage ( new Uri ( "buche_red_color_go.jpg", UriKind.Relative ) );
            imCan.Children.Add ( myImage );
        }
    }
}
 
Odgovor na temu

artriba
Split

Član broj: 158342
Poruke: 109
*.adsl.net.t-com.hr.



Profil

icon Re: SilverLight dinamički images01.05.2008. u 17:39 - pre 194 meseci
Code:
private void TextBlock_MouseLeftButtonDown ( object sender, MouseButtonEventArgs e )
        {
            ploca.Source = new BitmapImage ( new Uri ( "buche_red_color_go.jpg", UriKind.Relative ) );
        }

Code:
 <Canvas>
                <Image x:Name="ploca" Width="100" Height="100"/>
            <TextBlock Width="100" Height="20" Text="OK" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown"/>
            </Canvas>

Ne znam koliko je ovo stručno ali eto, niti zašto ono prije nije radilo
 
Odgovor na temu

[es] :: .NET :: WPF Programiranje :: SilverLight dinamički images

[ Pregleda: 3169 | Odgovora: 1 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.