I am developing a Windows Mobile 7 app to mimic an iPhone app I already developed. I am a C# developer and thought the Apple way would be hard but I found it fairly easy. Now trying to do the same thing in XAML is a nightmare or I am looking at the wrong things.
I would like to have a listbox with the items having an image as a background and also 4 textblocks. The list item obvisouly needs to show a click interaction (shows visual change when clicked) which I think is build in. I am using a button but it hides the textblocks, doesn't scale into the stackpanel I am putting it in.
Attached image for list item background, plus what code I currently have. Hope someone can do this easily (it is said to be easy but I am finding it hard)
Hi, you are on the right track (Listbox with ItemTemplate defined).
Few remarks, the image looks nice, but you can also create it in XAML (gradient bruses).
The main problem is that you have a stackpanel which contains the image and the stackpanel.
The width of the button isn't big enough to contain both image and the other stack panel... I would suggest the following:
The original image had some opacity so you can change the opacity of the boarder I have you if you'd like.
Btw, right now it looks like a Button which contains the Border/Image which inside it you have the text... Wouldn't it be better if the button itself would look like that image (Change the button template... but you will then need to also configure how it will look like when it is pressed, mouse over, etc)
I now have the code attached. I prefer using brushes rather than images, so much easier. If you could help me a bit further I would appreciate it.
- On clicking the "button" which really is a border with stack panel on top, I would like to make it look as clicked (perhaps draw the border pressed in with a darker colour). I am assuming I will have to create a style for Listbox itemselected but I have no ideas how to go about that
Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!
Ok, so you want a button that looks like the gradient button that I wrote, but still you have a button that surrounds it... Won't it be better if the whole button will look like it?
I also see that you use a ListBox.. List box has a SelectedItem propertym where the selected item is surrounded by a kinda dark bluish color.
If you don't need the selected item feature (for example, you just want to have a list of buttons) then use ItemsControl.
Btw, I never worked with Phone-7... I usually program on WPF and sometimes help people on Silverlight. Which architecture is it?? (I remember that it is Silverlight), cause Triggers are for example not well supported on Phone 7.
If triggers are not supported then I would need to use VisualStateManager.
For that I will probably need the System.Windows.Interactactivity and Microsoft.Expression.Interactions dlls (come from Blend).
What I really would like to display is a list of Accounts (Description and number) in a list so that when clicked I move to the next screen. This is a WP7 and I am porting the app from iPhone. iPhone uses UITableView with cells. I thought the best way to do in WP7 is in a listbox with buttons in it.
How would you go about this (assuming it was WPF windows app)?
BTW, I have Belnd 4 installed and it is meant to help with thisd kind of design but I don't seem to understand how it does things so I am just coding everything in VS2010 pro
I have it working. I had to change a bit to suit the WP7. Changed code attached. I still kept the Listbox as it allows dragging of items up and down the phone with finger :-)
Now, have you created the style code with VS (typing it yourself) or Blend? I just know that the next time I try to style a control i will run into a problem. The code behind is usually not a problem for me in WP7.
Thank you again for helping me. I couldn't have done without you
I was not aware that the author did not give the points to me, but if you read the posts carefully you will see that:
1) The original question was answered on my first 2 posts
2) Not only that I answered his questions, I've kept helping him, beyond the required and helped him with further questions.
Please try to contact the Author so he will know that he should award the points. Anyhow, I'm not seeing any logic in closing this question without awarding any points.
I appreciate your patience and I should have awarded the points which is what I intended to do but I am sure being a developer you can imagine what some projects can do to your mentality :-). Well done for suggesting that I close the question. The clean up mod is doing what he/she is supposed to do and I take the full blame in not managing my question timely.
Thank you again and I am sure will be asking you another XAML Q soon
H
Not the solution you were looking for?
IT issues often require a personalized solution. With Ask the Experts™, submit your questions to our certified professionals and receive unlimited, customized solutions that work for you.
Premium Content
You need an Expert Office subscription to comment.Start Free Trial