|
That is the simple way. Don't try and complicate things for yourself.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Dear Josh,
I went thru your article and many more articles for bindinf a tree view with database. My problem is still unresolved.
my requirement is, I have three tables linked togather as below
1-Order table contains, partyCode and orderNo.
2-Item table contains, orderNo & ItemCode.
3-Stages table contains, orderNo, itemCode & stageCode.(Same stageCode can appear in the table for different items, but not for same Items. Items may or may not have stages. If Item has stages, then entry for such Item will be available in stage table. Otherwise not.)
I am unable to generate a tree in below manner:
Tree display
ord1
...Item1
.......stage1
.......stage2
...item2
.......stage1
.......stage2
.......stage3
...item3
...item4
...item5
...item6
...item7
...item8
...item9
ord2
……
ord3
…….
please help me in generating a tree of such type. I am using dataservices to getch the data from database.
|
|
|
|
|
|
I have the following xaml (nonessential markup removed in the interest of brevity):
<navigation:Frame x:Name="ContentFrame" >
<navigation:Frame.UriMapper>
<uriMapper:UriMapper>
<uriMapper:UriMapping Uri="/{pageName}"
MappedUri="/Views/{pageName}.xaml"/>
<uriMapper:UriMapping Uri="/FMChart/{metricID}/{orgID}"
MappedUri="/Views/FMChart.xaml?metricID={metricID}&orgID={orgID}"/>
</navigation:Frame.UriMapper>
</navigation:Frame.UriMapper>
</navigation:Frame>
I'm creating the HyperLinkButton objects dynamically (in code), like so:
int metricID = 1;
int orgID = 1;
HyperlinkButton button = new HyperlinkButton();
button.Name = Guid.NewGuid().ToString();
button.TargetName = "ContentFrame";
<br />
<big>string url = string.Format("/FMChart/{0}/{1}", metricID, orgID);</big>
button.NavigateUri = new Uri(url, UriKind.Relative);
When I click the bbutton, the browser renders a blank page, and eventually presents me with a REALLY long stack trace (InvalidOperation exception). If I take the parameters out of th indicated line:
string url = "/FMChart";
...it works as expected (brings up the desired page).
What am I doing wrong?
SOLUTION ===========================================
It seems that the order of the UriMappers in the XAML matters. Originally the mapping I specified was the last one listed in the group. When I changed it to be the FIRST item in the group, it worked. The reason I say this is"sorta" solved is that I think this is a bug in Silverlight. It was a unique mapping (compared to all of the others) and should have been discovered by Silverlight in the original order.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
modified on Friday, April 16, 2010 2:22 PM
|
|
|
|
|
John Simmons / outlaw programmer wrote: <urimapper:urimapping uri="/FMChart/{metricID}/{orgID}" mappeduri="/Views/FMChart.xaml?metricID={metricID}&orgID={orgID}">
Not absolutely certain, but should the Uri not be Uri="/FMChart/{metricID}&{orgID} ?
|
|
|
|
|
I tried that too, and that didn't work either. BTW, the format of the string has been represented both ways (and on the official MS site, it's the way I have it). I've trie it the following ways:
uri = "/FMChart/{metricID}/{orgID}"
uri = "/FMChart/{metricID}& amp;{orgID}"
uri = "/FMChart/{metricID}&{orgID}"
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
John Simmons / outlaw programmer wrote: It seems that the order of the UriMappers in the XAML matters. Originally the mapping I specified was the last one listed in the group. When I changed it to be the FIRST item in the group, it worked. The reason I say this is"sorta" solved is that I think this is a bug in Silverlight. It was a unique mapping (compared to all of the others) and should have been discovered by Silverlight in the original order.
This is interesting.
Let me see if I get some time to play around with the navigational framework.
modified on Saturday, April 17, 2010 2:27 AM
|
|
|
|
|
Hi,
I am trying to encrypt my appSettings section through code but i am facing some problem.
This is what is am doing
-- app.config
<? xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Encrypt" value="Encrpyted"/>
</appSettings>
</configuration>
--Code
string s = System.IO.Directory.GetCurrentDirectory();
s = s + "\\Test_Encrypt_1_WPF.exe.config";
Configuration config = ConfigurationManager.OpenExeConfiguration(s);
AppSettingsSection section = (AppSettingsSection)config.GetSection("AppSettings");
if (!section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection("RsaProtectedConfigurationProvider");
}
config.Save(ConfigurationSaveMode.Modified);
In the above code the "section" object is showing null i.e. i am not able to find the "AppSettings" section.
I even tried configuration/appSettings but the same result.
Can anyone please help!
Thanks in advance,
Samar
modified on Thursday, April 15, 2010 6:57 AM
|
|
|
|
|
Hi All,
I got the solution myself.
Instead of
string s = System.IO.Directory.GetCurrentDirectory();
s = s + "\\Test_Encrypt_1_WPF.exe.config";
Configuration config = ConfigurationManager.OpenExeConfiguration(s);
i wrote
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
This worked!!
Regards,
Samar
|
|
|
|
|
|
Hi Mark,
I was not able to find the link you have mentioned when i was searching.
The solution in the link looks pretty similar to what i have tried.
Please do let me know if i am incorrect in any way on stating the above.
Regards,
Samar
|
|
|
|
|
It is the same, but at least you have an example that should work.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Yes you are right. Thanks.
Regards,
Samar
|
|
|
|
|
Hi All,
I am facing a performance issue with WPF Toolkit datagrid. In my application I have created a view containing multiple Data Grids (around 15) with about 100 rows in each grid. The view shows 15 rows for each grid. The grids are placed in an ListView, so when I scroll in the list view I am experiencing a performance hit.
Can anyone guide me to resolve the issue.
Thanks
|
|
|
|
|
I have no idea about the datagrid, but did you Virtualized your ListView?
e.g.
<ListView
VirtualizingStackPanel.IsVirtualizing="True"
VirtualizingStackPanel.VirtualizationMode="Recycling"
...
/><a href="http://www.quickzip.org">QuickZip</a>
|
|
|
|
|
I would like to create a question appear in a parent button.. (I use button because it's easy to animating them).. in this question I'd like use button too.. where it can appear every a question have been answered... and this question randomize.. like in a moment there's a two button/image appear.. and we anwered them with clik an answer in button answer.. if correct.. then a new question appear with 5 button appear.. and so on..
please help me to make the algorthm.. I'd use C#.. this is my first project..
|
|
|
|
|
Wrong forum mate.
Your question has nothing to do with Silverlight, right?
|
|
|
|
|
|
yuripon wrote: I create it in SL 3..
You would need to add C# code in your code behind file. This code should generate a button dynamically.
See here.
|
|
|
|
|
thx for your solution..
|
|
|
|
|
You may also try creating a UserControl and then use it for your application. I think, it will be useful and handy in your case.
|
|
|
|
|
i've try it, but it can't. can you give me a sample. I would like create random button or image appear when it's loaded, and it's can change how many button or image appear in current time. Like the first button appear 2 buttons or images when loaded, and we click other button(outside of the buttons which created).. and than the next random button appear with different buttons (may be 3 buttons appear or 10 button).
|
|
|
|
|
Hi all, i'm making a project in AI,i'm buil a game Missionaries and Cannibals with GUI by WPF, but i don't know how to solve mouse event such as mouse_hover,mouse_click..., any body can help me. There are many problem i have to solve, poor myself...
|
|
|
|
|
I suggest you do some research around writing WPF applications, doing it well is pretty different from Winforms.
The other thing is, I'd look at the AI stuff first as it's the most difficult, you can always get to grips with WPF as you go along.
Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.
|
|
|
|
|
Don't just dive in, some of WPF is very different from previous technologies. I would suggest this excellent range of tutorials (which includes events)
WPF: A Beginner's Guide - Part 1 of n[^]
shane
|
|
|
|