I am fairly new to WPF and have not mastered MVVm so I'm building my treeview manually like so:
The image file for the state does not load despite it being in the relative path in the project. Does it ned to be loaded in as a resource somehow rather than just specifying the relative path?
Also what is the format of the path when bringing a TreeViewItem into view (auto scrolling) in a non-bound scenario like this, when there is more than one level involved? I thought I saw somewhere to separate the levels items with a " | " but it doesn't seem to work.
as in:
Thanks,
Jonathan
private void BindTreeToZipCodes(RadTreeViewItem parentNode) { if (parentNode == null) { trvZipCodes.Items.Clear(); List<State> _states = StateService.GetActive(); foreach (State _state in _states) { RadTreeViewItem node = new RadTreeViewItem() { Header = _state.StateDescription }; node.DefaultImageSrc = "Resources/folder.png"; node.Tag = "State"; if (_state.StateCode == _selectedDealer.StateCode) { node.IsExpanded = true; node.IsSelected = true; _selectedPath = _state.StateDescription; } else { node.IsExpanded = false; } trvZipCodes.Items.Add(node); //call recursively to add zip parts BindTreeToZipCodes(node); } } else //parent node is not null - what level is it { if (((string)parentNode.Tag) == "State") { List<ZipCodePart> _zipParts = ZipCodePartService.GetForState(parentNode.Header.ToString().Substring(0, 2)); foreach (ZipCodePart _zipPart in _zipParts) { RadTreeViewItem node = new RadTreeViewItem() { Header = _zipPart.ZipPart }; node.Tag = "ZipPart"; parentNode.Items.Add(node); } if (parentNode.IsSelected == true) { _selectedPath += " | " + _zipParts[_zipParts.Count - 1].ZipPart; } } } }The image file for the state does not load despite it being in the relative path in the project. Does it ned to be loaded in as a resource somehow rather than just specifying the relative path?
Also what is the format of the path when bringing a TreeViewItem into view (auto scrolling) in a non-bound scenario like this, when there is more than one level involved? I thought I saw somewhere to separate the levels items with a " | " but it doesn't seem to work.
as in:
BindTreeToZipCodes(null); trvZipCodes.BringPathIntoView(_selectedPath);Thanks,
Jonathan

