|
Is it possible to write and run a basic Hello World Silverlight Application using just Notepad, the C* compiler and the command prompt?
Call me crazy but I like to work from first principles. Gives me a better and in-depth understanding of everything. Also helps me to give my students a fundamental view of programming
Have tried it without success and I am wondering if anyone out there has tried it?
|
|
|
|
|
|
|
Hi
Thanks for putting this example. But, everywhere I find example of ArrayList containg strings. Is there a way to bind a collection of custom objects?Please advise.
Something like this instead of string collection :
public AlbumCollection GetAlbums()
{
var albumCollection = new AlbumCollection();
albumCollection.Album.Add(new Album() { Description = "A1 Desc", Name = "A1 Name", Id = 1 });
albumCollection.Album.Add(new Album() { Description = "A2 Desc", Name = "A2 Name", Id = 2 });
albumCollection.Album.Add(new Album() { Description = "A3 Desc", Name = "A3 Name", Id = 3 });
albumCollection.Album.Add(new Album() { Description = "A4 Desc", Name = "A4 Name", Id = 4 });
return albumCollection;
}
--------------
public partial class AlbumCollection
{
[EditorBrowsable(EditorBrowsableState.Never)]
private List<Album> albumField;
[System.Xml.Serialization.XmlElementAttribute("Album")]
public List<Album> Album
{
get
{
if ((this.albumField == null))
{
this.albumField = new List<Album>();
}
return this.albumField;
}
set
{
this.albumField = value;
}
}
}
public partial class Album
{
[EditorBrowsable(EditorBrowsableState.Never)]
private List<Document> documentField;
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
[System.Xml.Serialization.XmlElementAttribute("Document")]
public List<Document> Document
{
get
{
if ((this.documentField == null))
{
this.documentField = new List<Document>();
}
return this.documentField;
}
set
{
this.documentField = value;
}
}
}
Please advise. Thanks
Pankaj
Follow your goals, Means will follow you ---Gandhi---
|
|
|
|
|
Do you have an example binding to an AlbumCollection
that doesn't work?
I personally make my custom collection classes like this:
public class AlbumCollection : List<Album>
{
}
so AlbumCollection is a collection instead of contains a collection.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi All,
I am just starting with WPF to implement rich GUI application. I have design in my mind and would like you to give suggestion to make it better.
---------------------------------------------------
dropDown1 dropdown2 dropdown3
----------........---------........---------
..........|......|.........|......|.........|
..........|......|.........|......|.........|
..........|......|container|......|container|
Tree view.|......|..with...|......|..with...|
..........|......|.multiple|......|.multiple|
..........|......|list view|......|list view|
..........|......|.........|......|.........|
..........|......|.........|......|.........|
----------.......-----------......-----------
---------------------------------------------------
Above is the design i would like to implement. How it should work?
- a user will select an option from dropDown1 and treeview will be filled with hierarchy of active, pending, closed guests.
- When user will select an option from dropDown2/dropDown3 it will fill respective containers with list views (no of list views will be decided at run time by retrieving count from DB so there is requirement that container should pop up scrollbars if listviews crosses the bounds)
- Now user will move (drag and drop) guest from treeview to list view.
This is how application would work. I need your suggestion if this would be easy to implement in WPF. Also share your view on this.
Thanks,
AksharRoop
|
|
|
|
|
AksharRoop wrote: if this would be easy to implement in WPF
Yes.
That question is really relative to who answers it.
If you don't think it would be easy, then I reckon you
have some studying to do
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Any good sample that would help me with this?
|
|
|
|
|
AksharRoop wrote: Any good sample that would help me with this?
There's tons of sample code floating around the internet and on
this site.
I highly recommend studying at least the first 3 or 4 chapters
of the WPF documentation...It will save you a lot of time in the
long run...
Windows Presentation Foundation[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
hi guys,
I've developed a graph control in GDI+ and used a timer in it.. now i'm converting it to WPF. but when i went on and search for a timer there is no timers in WPF... how can i resolve this problem?any alternative to use?
regards,
rangana.
|
|
|
|
|
You can use System.Threading.Timer just like you would in non-WPF code. The problem that you will likely encounter is that DependencyObjects (many object within WPF derive from a DependencyObject) often need to be used within in the object's original thread context. This is easily handled by having your background thread trigger an action within the dependency object's thread. For example to make a TextBlock with a background that alternates between red and blue every 1 second, try the following:
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
class FlashingText : TextBlock
{
Timer timer;
public FlashingText() {
timer = new Timer(new TimerCallback(Flash), null, 0, 1000);
}
void Flash(object state) {
Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(ToggleColor));
}
void ToggleColor() {
Background = Background == Brushes.Blue ? Brushes.Red : Brushes.Blue;
}
}
A few notes of caution:
I have not tested the code above, I just scribbled it out to illustrate a concept. It may need a few tweaks to compile.
Also, composing a graph with a large number of elements within WPF will often slow the UI thread and may lead to temporary hanging of the UI. To reduce this problem, there are a number of techniques that can reduce or eliminate this issue. In my experience, drawing more than a few thousand points is likely to provide disappointing UI interaction without an efficient design.
|
|
|
|
|
Can any one tell me where can I get some free XAML(WPF) Template or theme for business application.
Thanking in Advance
Johnny
|
|
|
|
|
Saiyed Alam wrote: Can any one tell me where can I get some free XAML(WPF) Template or theme for business application.
Look at some of the WPF articles here on CodeProject, there is a superb collection of free code and step by step guidance.
|
|
|
|
|
I have defined a grid like this:
<br />
<Grid.RowDefinitions> <br />
<RowDefinition Height="Auto"/><br />
<RowDefinition Height="*" MinHeight="300" /><br />
<RowDefinition Height="Auto"/><br />
<RowDefinition Height="Auto"/><br />
</Grid.RowDefinitions>
I would like to know what the height of Grid.Row 1 is at runtime. Giving it a name and asking for the height only returns a "*". Is there a way to determine this?
Thanks
|
|
|
|
|
Never mind. I just added a panel around everything in that grid row and the panel knows how high it is.
Thanks
Brent
|
|
|
|
|
This is not done in wpf. In wpf panel is not available, so i am using stack panel but still i am getting height = 0 at run time. Is there any other way to find height of grig at run time?
|
|
|
|
|
i have same problem, but i want to get height of grid at run time. Is there any way to get height of grid in wpf at run time?
|
|
|
|
|
Check the ActualHeight and ActualWidth properties.
Brent
|
|
|
|
|
Hi friends i want to animate the listboxITem on load of the listbox just similar to twitter blu.
i create a template for the listItem and onload event i give animation to it but when listbox loaded all the listITem animate at the same time. plz give some idea????
WANTED wasim khan(Killed 50 Innocent Buggs, Distroyed 200 Exception, make 5 Project Hostage) any Compnay Hire him will pay 30,000. Best place where u can get him is Sorcim Technologies Murre Road RWP
|
|
|
|
|
In window form i can create 1 image and drag it from 1 place to another by:
Image_MouseDown, Image_MouseMove and Image_MouseUp but in WPF i make 1 grid(create 5 row and 5 column) and i add child (image) to row 2 and column 2 then 1 make same events but i can't drag it.
please make a solution .
Thank.Sorry for my english !
|
|
|
|
|
It works the same way, the only thing is, the way that things are laid out in WPF is a little different. What have you tried ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
The grid have 5 ColumnDefinitions and 5 RowDefinitions.
If image i can get current Column and Row by GetValue(Grid.RowProperty) and GetValue(Grid.ColumnProperty)
. But i don't know how to get current Column and Row of Mouse.
If know i can SetValue.
Thank !
|
|
|
|
|
Oh, you want to know what column and row the mouse is over ? I'd imagine you'd need to turn the rows and columns into pixel positions to calculate that, but then, if you caught the mouse move event in each grid square, you could just track which square control got the event last.....
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Can you show me how to "caught the mouse move event in each grid square".
Thank
|
|
|
|