|
What does either answer even have to do with the OP's question? Not a dang thing .
|
|
|
|
|
I use a class called TreeNodeUI
public class TreeNodeUI
{
public TreeNodeUI(string sLabel,string sNodeKey,object oTag)
{
NodeLabel = sLabel;
NodeKey = sNodeKey;
NodeTag = oTag;
ChildNodes = new ObservableCollection<TreeNodeUI>();
}
public string NodeLabel { get; set; }
public string NodeKey { get; set; }
public object NodeTag { get; set; }
public ObservableCollection<TreeNodeUI> ChildNodes { get; set; }
}
and I load it with
public void LoadTree()
{
NodeList.Clear();
gUI.TreeNodeUI oNode;
FurnishCategoryList.OrderBy(x => x.Category);
foreach (FurnishCategoryDB oDB in FurnishCategoryList)
{
oNode= new gUI.TreeNodeUI(oDB.Category, string.Format("/{0}/", oDB.FurnishCategoryID), oDB);
LoadNode(oNode, oDB.FurnishCategoryID);
NodeList.Add(oNode);
}
}
private void LoadNode(gUI.TreeNodeUI oParent, int iCategoryID)
{
List<FurnishSubCategoryDB> lSC = VML.FurnishSubCategoryVMStatic.FurnishSubCategoryList.Where(x => x.CategoryID == iCategoryID).ToList();
oParent.ChildNodes.Clear();
foreach (FurnishSubCategoryDB oDB in lSC)
{
oParent.ChildNodes.Add(new gUI.TreeNodeUI(oDB.SubCategory, string.Format("/{0}/{1}/", oDB.CategoryID, oDB.SubCategoryID), oDB));
}
}
Note that I put the object into the NodeTag property for convenient retrieval.
Caveat I am bloody sure this is probably the most resource intensive method of managing a tree but it works!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
How is it possible to update a datagrid row?
While in the datagrid, I can change the value of one of the cells in a row but to update the data in the database, Is it that I first have to update the collection which is bound to the datagrid?
It seems that the datagrid in silverlight is quite different to that in asp.net because in asp.net, if I remember correctly, the datagrid has events for the edit, update, delete ?
Thanks
|
|
|
|
|
You can only update the database via a service.
You cannot directly update the service.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
I am aware of the service but should the collection which populates the datagrid be updated first and then pass that to the service?
Thanks
|
|
|
|
|
That is sort of left to you.
You can update the collection or just send the "changed" values to the service (This way you can reduce network traffic).
Its basically left to how you implement this yourself.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Should the datagrid go into edit mode first to change the specific row in the datagrid?
|
|
|
|
|
Yes. This article[^] might help you (although its for SL2).
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
|
WPF binding is very different to (and much better than IMO) ASP.NET binding. WPF is unlike winforms or ASP.NET, so developers have to get their head around the change, which is substantial.
You bind an object exposing INotifyPropertyChanged a collection exposing IObservableCollection . If the binding is two-way, the object/collection is updated automatically. It is unlikely that this should be persisted immediately (in most circumstances the user would OK this somehow). Generally what would happen is the bound object would persist the changes. This is a better separation of concerns, and more flexible than binding an SQLDataSource to a grid as in ASP.NET.
This article explains a pattern that goes hand in hand with WPF: Model-View-ViewModel (MVVM) Explained[^] it should clarify things for you.
|
|
|
|
|
Hi,
Would you know how I do pass a command line with WPF (in VB.net)?
In WindowsForm I used
Shell("cmd.exe /c mame -listxml >xmlout.xml", 0, True)
(the app. Name and parameters, show/hide window, wait or not for the task being completed)
Unfortunately this line doens't work anymore in WPF
What should I use to send a command line with parameters?
Thanks very much for any kind help
modified on Tuesday, April 5, 2011 3:47 AM
|
|
|
|
|
|
Hello all,
I've started to learn XAML last night. I just write a sample code like this,
<Page xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
<TextBlock Text=”Hello World!” />
</Page>
and when I open it on FireFox, it continuously ask to open with FireFox. I'm really worried. I tried with the IE and Chrome, but no luck. How can I test *.xaml files?
Thanks
I appreciate your help all the time...
CodingLover
modified on Wednesday, April 6, 2011 12:03 AM
|
|
|
|
|
What has XAML to do with a browser, are you starting to dabble in Silverlight by any chance, SL is hosted inside an ASPX page not directly in a browser.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Interesting,
I've simply tried this from Sams' WPF book
1. Open your favorite text editor, such as Notepad.
2. Create a plain text document and enter the following:
<Page xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”
xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>
<TextBlock Text=”Hello World!” />
</Page>
3. Save the text file and name it HelloWorld.xaml.
4. Double-click the newly created file, and it should open in a web browser. If
another application has been mapped to .xaml, you will need to launch the
browser first (either Internet Explorer 7 or Firefox will do) and drag the file
into the browser.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You won't see this run in a web browser because xaml is just XML markup. What you'd see in the browser in this case is the XAML, and that's it. If you want to just test the XAML (and not run it as an application), you need something like Kaxaml[^] which will compile the XAML for you and present it as an application.
|
|
|
|
|
Make sense to me. Thanks for the comment.
I've downloaded latest version and install in Win 7. However it's unexpectedly closed when I start work with it. I've install .Net 4.0 as well.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
So I move with VS 2008 and Kaxaml. Seems Kaxaml is easy to use for me.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Try using Visual Studio or Expression Blend to edit / open your xaml files.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
I've look at Blend, but the reason is I cannot pay for that. So I'm searching for a free simple tool. Since I'm not doing any commercial stuff that a simple tool is enough.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Download Visual C# Express, (or Visual Studio Express). It's free, and it's easier to work with than just coding in notepad.
|
|
|
|
|
Actually I've install all VS 2005, 2008, 2010. But what I've found from further reading is that VS cannot do the best in styling and all in XAML. Blend or such similar tools done the best.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Glad to help. VS2010 is probably your best bet because the Cider engine (that's the name of the XAML designer) is vastly superior to the one in VS2008. You can't do WPF development at all in VS2005 (and you can't target .NET 4 in VS2008).
|
|
|
|
|
You are right. And I cannot go ahead with VS 2010, it's just web developer express 2010.
I appreciate your help all the time...
CodingLover
|
|
|
|
|