Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I'm still a student (4th year univ) and I've worked alot with C# but only recently came to know the possibilities of WPF. I've been using WPF for the last month or so now. My interest in WPF is that for developing Applications which can be used on touch screens.

My idea for what I'm developing a Touchable Application to be used in recreational areas.

1. The app will consist of many smaller apps which i have many already developed. (ex. browser, photoviewer, facebook, mail ....) Now I need to link all theses small apss/windows all together. Now I wish to be kindly directed what is the best practice to do this.

http://i46.tinypic.com/1zpqv6t.jpg

What I'm planning here is to have a welcome screen with 3 image buttons as a Main Menu, Each Menu will have other items and so on. There can as much as 5 clicks to get to the smaller app. How do I build this? Cause I really have no idea where to start, do i use multiple windows or use different Panels?



2. One of my menus will contain dynamic buttons as it will be a list of products available for sale retrieved from the database. Now I need these buttons to be image buttons.

currently I have this code: (MenuName is the name of the image already in the project)

<Window.Resources>
<ControlTemplate x:Key="btnTemplate" TargetType="{x:Type Button}">
<Image x:Name="Image1" Source="{Binding MenuName}"/>
</ControlTemplate>
</Window.Resources>

-----------------------------------------------------------------------
string MenuName;

private void addChildren()
{
Window1 window1 = new Window1();
Style buttonStyle = window1.Resources["btnTemplate"] as Style;

foreach (item in database)
{
Button btn = new Button();
btn.Name = "btnProduct"+item;
btn.Style = buttonStyle;
MenuName = "menu"+item+".png";
btn.Click += new RoutedEventHandler(buttonClick);
MainGrid.Children.Add(btn);
}
}

private void buttonClick(object sender, EventArgs e)
{
Button btn = (Button)sender;
MessageBox.Show("this is product " + btn.Name);
}



atm I'm catching this exception <b>An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll </b>and it's thrown in the constructor. Any help?
Posted
Updated 10-Feb-10 20:50pm
v4

1 solution

Xihadd wrote:
Now I need to link all theses small apss/windows all together. Now I wish to be kindly directed what is the best practice to do this.


I guess have a central app that runs them and sits behind them as they run


Xihadd wrote:
There can as much as 5 clicks to get to the smaller app. How do I build this? Cause I really have no idea where to start, do i use multiple windows or use different Panels?


I would suggest that you have controls for each menu step and show a different control based on the prior selection.


Xihadd wrote:
Window1 window1 = new Window1();


Why ?


Xihadd wrote:
atm I'm catching this exception An unhandled exception of type 'System.StackOverflowException' occurred in PresentationFramework.dll and it's thrown in the constructor. Any help?


At a guess, the constructor calls addChildren, and the class is Window1. So, each constructor, calls a method that creates a new instance of Window1, so it recurses until it blows up.

We'd have to see the constructor to help if that's not the answer.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900