|
They don't need to be the same type... heck, I can have a collection of objects and put random crap in there. You can only have one ItemsSource though. Thats his issue.
|
|
|
|
|
SledgeHammer01 wrote: You can only have one ItemsSource though. Thats his issue.
And how many types can you put into and ItemSource?
Stating you can only have 1 ItemSource does not solve the problem which is how to get multiple types into 1 ItemSource.
SledgeHammer01 wrote: I can have a collection of objects and put random crap in there
Isn't that what I just explained how to do?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah, I guess you kind of did . It wasn't very clear the first time I read it that thats what you were getting at. I explained in more detail in my original response.
|
|
|
|
|
Hmm I find clarity can be a major issue, I find myself repeating a description using slightly different wording just to see the light of understanding appear in their eyes.
If you used a collection of objects what property would you use to display in the treenode?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Well, OP didn't get your response either . Now you and I are actually on the same page, but just arguing about semantics haha. Yeah, I guess you can't really do it with a generic object collection... in my original response, I suggested the use of a common base class and putting the properties there... but you really have to structure the properties so you have them for both types.
|
|
|
|
|
SledgeHammer01 wrote: Well, OP didn't get your response either
I know- as I said clarity can be an issue with me.
I'll be extremely interested in Kevin's ultimate solution to see if it is something new!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I don't agree with that. I have other projects with collections of different types, and this type of data template works fine. I just can't see what's wrong here.
Everything makes sense in someone's mind
|
|
|
|
|
I'll be interested in your eventual solution.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
See my other response. You can have multiple object types, but you must combine them into a SINGLE collection. Right now you have 2 separate collections a FolderCollection and a FileCollection or whatever you call them. You need to have a generic ObjectCollection or whatever and use the template to decide how to render... or you can manually insert into the tree, but thats lame. Just throwing that out there as an option though .
|
|
|
|
|
I don't think you can do it the way you are trying to. HierachialDataTemplate only supports a single ItemsSource at any given level. What you want to do is define your models something like:
FileModelBase
FileModel
FolderModel
and put all the common code into the base class. Then, instead of having a Folders collection and a Files collection, you just have a single collection that holds both types. You can use triggers in your data template to change the rendering based on the type. Well, not on the type, but maybe a bool or enum in FileModelBase.
|
|
|
|
|
Well, you and Mycroft were right. My confusion came from another project I did where I had 2 collections on each object. However, I went back & found that in that project I wasn't displaying the second collection.
I implemented Mycroft's solution - create a single class with a Children collection.
Thanks to you both.
Everything makes sense in someone's mind
|
|
|
|
|
Superficially, you could think that they are the same thing (indeed, a tooltip behaves just like a popup with the TooltipService controlling the lifetime and display of the popup). They aren't the same thing though - basically, a popup allows you a lot more programattic control over where it appears, how it's triggered and how it's unloaded, etc.
If you just want to display a little bit of text (possibly with an image) against a control, use a tooltip. If you want something that can be triggered over the top of something else, and can do things such as handling interaction, use a popup.
|
|
|
|
|
Actually, there are a few other subtle differences:
* Tooltips aren't allowed to have logical or visual parents while Popups can
* Tooltips are content controls and have a content template while a Popup does not
|
|
|
|
|
The second point is WAY more important .
With a ContentControl, you specify your business object (of ANY type -- note it is system.object) as the content and use the content template to specify how to render it. With a Popup, there is no such mechanism, you can't specify your business object as the content because only visuals are allowed. So you would have to hard code the Popup to your business object. I suppose you could template the whole thing and swap out templates at runtime, but thats just re-inventing the wheel of what a ContentControl already does.
|
|
|
|
|
Afternoon,
I was wondering what people though the best way to save data locally, I dont want to export to txt files. When I was developing for Windows phone, I used isoloated storage, but ov this isnt available.
Thanks.
|
|
|
|
|
Of course IsolatedStorage is available in WPF. If it isn't then there's some smoke and mirrors going on in our current codebase which uses it.
|
|
|
|
|
Just use the application settings. Thats what they are there for . Unless its big data, then you shouldn't store it there. You didn't say what kind of data you want to store.
|
|
|
|
|
1. Create an object that describes your data
2. Serialize it as XML file
3. If your data contains any bitmaps, add those to a seperate folder
4. zip the whole content and add the file extension that is associated with your WPF application
5. save the file
do the reverse order to get it loaded. select the File, Unzip and deserialize
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Hi,
I want to define a grid. Over which when i move/drag some user control like calender it triggers some event.
|
|
|
|
|
Have a look at[^] Drag drop facilities as provided by WPF.
|
|
|
|
|
Hi,
I have added a web service reference in my WPF application. VS automatically adds some binding tags and endpoint address like http://mydomain.com/services/sample.asmx in the app.config file.Now when I deploy this application with setup project and install it, application folder contains myapplication.exe.config file which displays this endpoint address and other binding details. I need to hide this details from the user. As user may change this details.
1. Should I hide binding details anyhow? so that it will not be visible to the application user.
2. Can I move this reference to any other file or may be in the project dll itself?
Your help would be appreciated.
Regards
|
|
|
|
|
You can feed the endpoint in from your code - there are a couple of articles on dynamic endpoint set up.
However I would not bother if a user fiddles with a config file you need to shoot the user. It is easy (for you) to recover from the problem and it will identify an idiot in your organisation.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Thanks for the suggestion Mycroft.
Mycroft Holmes wrote: However I would not bother if a user fiddles with a config file you need to shoot the user. It is easy (for you) to recover from the problem and it will identify an idiot in your organisation.
That is good point.
Actually I am implementing user activity tracking application, so if user is idle for X min it will call a web service and add idle entry in the database for that user. This details will be used in the reporting.
Now we are technical team, anyone can change this endpoint and stop the web service call. so I must have to take some security steps.
I will try to follow dynamic binding from the code side.
Thanks for the help.
Regards
|
|
|
|
|
Why not reverse the reporting process - n# Activities in x minutes then if they break the connection they get ragged on for not working. Or change the way you present it, if they pass a reasonable minimum threshold then they are rewarded instead of hassled.
Morale must be really crappy in your organisation if such a negative outlook is predominant.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|