Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - Image resources

 
 
Old 11-07-2006   #1 (permalink)
Jan Kucera


 
 

Image resources

Hi,
If I set the application icon in the project properties, How can I load it
to the WPF window icon?

Can I store the graphics in XAML?

How can I set the graphics in databound control item, eg. in
treeview/listbox etc?

Thanks,
Jan


My System SpecsSystem Spec
Old 11-14-2006   #2 (permalink)
Bob


 
 

Re: Image resources

In article <6F4641EE-0206-4305-9B1D-07F04B80C366@microsoft.com>,
uam@centrum.cz says...
> Hi,
> If I set the application icon in the project properties, How can I load it
> to the WPF window icon?
>
> Can I store the graphics in XAML?
>
> How can I set the graphics in databound control item, eg. in
> treeview/listbox etc?
>
> Thanks,
> Jan
>
>

When you browse for and set an icon file in the project properties in
Visual Studio, you will see that file appear in the solution explorer as
it has been added to the project (physically) and will be compiled as a
resource. To get that icon to actually be used in the Window specify the
Icon property for the Window Object in the XAML:

<Window x:Class="myapp.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="iconplay" Height="300" Width="300"
Icon="myicon.ico"
>

.....

store the graphics in XAML? ==> You can declare (vector) objects that
are graphics in XAML. Have a look at the System.Windows.Shapes Namespace
and its derived classes as in:
<Line X1="200" Y1="150" X2="300" Y2="250" Stroke="Red" />

raster graphics are handled by the Image class:
<Image>
<Image.Source>
<BitmapImage UriSource="myjpg.jpg" />
</Image.Source>
</Image>

......

set the graphics in databound control item?==> You will need to use a
DataTemplate. see "Data Templating Overview" in the SDK docs.

HTH,
Bob




My System SpecsSystem Spec
Old 11-15-2006   #3 (permalink)
Jan Kucera


 
 

Re: Image resources

Hi Bob!
Thank you for your answer, it is exactly what I was asking.
For graphics in DataBound item I found that I would need write the
converter.

Just a little question - can I embed the resource in xaml like CDATA or
something?

Thanks,
Jan


"Bob" <bb_brt@yahoo.com> wrote in message
news:MPG.1fc3fd7358572fc0989680@news.comcast.giganews.com...
> In article <6F4641EE-0206-4305-9B1D-07F04B80C366@microsoft.com>,
> uam@centrum.cz says...
>> Hi,
>> If I set the application icon in the project properties, How can I load
>> it
>> to the WPF window icon?
>>
>> Can I store the graphics in XAML?
>>
>> How can I set the graphics in databound control item, eg. in
>> treeview/listbox etc?
>>
>> Thanks,
>> Jan
>>
>>

> When you browse for and set an icon file in the project properties in
> Visual Studio, you will see that file appear in the solution explorer as
> it has been added to the project (physically) and will be compiled as a
> resource. To get that icon to actually be used in the Window specify the
> Icon property for the Window Object in the XAML:
>
> <Window x:Class="myapp.Window1"
> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
> xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
> Title="iconplay" Height="300" Width="300"
> Icon="myicon.ico"
>>

> ....
>
> store the graphics in XAML? ==> You can declare (vector) objects that
> are graphics in XAML. Have a look at the System.Windows.Shapes Namespace
> and its derived classes as in:
> <Line X1="200" Y1="150" X2="300" Y2="250" Stroke="Red" />
>
> raster graphics are handled by the Image class:
> <Image>
> <Image.Source>
> <BitmapImage UriSource="myjpg.jpg" />
> </Image.Source>
> </Image>
>
> .....
>
> set the graphics in databound control item?==> You will need to use a
> DataTemplate. see "Data Templating Overview" in the SDK docs.
>
> HTH,
> Bob
>
>
>
>


My System SpecsSystem Spec
Old 11-15-2006   #4 (permalink)
Bob


 
 

Re: Image resources

In article <A4A1200F-99D2-4A8B-ADEF-11E92B221F14@microsoft.com>,
uam@centrum.cz says...
> Hi Bob!
> Thank you for your answer, it is exactly what I was asking.
> For graphics in DataBound item I found that I would need write the
> converter.
>
> Just a little question - can I embed the resource in xaml like CDATA or
> something?
>
> Thanks,
> Jan
>
>
> "Bob" <bb_brt@yahoo.com> wrote in message
> news:MPG.1fc3fd7358572fc0989680@news.comcast.giganews.com...
> > In article <6F4641EE-0206-4305-9B1D-07F04B80C366@microsoft.com>,
> > uam@centrum.cz says...
> >> Hi,
> >> If I set the application icon in the project properties, How can I load
> >> it
> >> to the WPF window icon?
> >>
> >> Can I store the graphics in XAML?
> >>
> >> How can I set the graphics in databound control item, eg. in
> >> treeview/listbox etc?
> >>
> >> Thanks,
> >> Jan
> >>
> >>

> > When you browse for and set an icon file in the project properties in
> > Visual Studio, you will see that file appear in the solution explorer as

> Jan asked...
> Just a little question - can I embed the resource in xaml like CDATA or
> something?


The question begs: "Why bother?" are you looking to use only loose XAML?
All the intelligent minds at MS came up with XAML and codebehind,
marrying them together (via the partial keyword) into a single class, as
a means to cleanly seperate the visual design from the nuts and bolts on
the backend. If you are still interested, google up "XAML + CDATA" and
see how to place code in the markup and the XAML compiler will take care
of it.
HTH,
Bob
My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Various Errors - winlogon.exe Bad Image, Windows - Bad Image & Window Defender General Discussion
Acronis True Image recovery of Vista Image Vista General
Image Restore Problem: Can't Locate Image Vista General
Not enough resources Vista hardware & devices


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46