|
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
|
|
|
|
|
|
If I were you, and I was working in such a controlling environment, I would look for another job. No good can come from such an application.
|
|
|
|
|
I have this data template:
<DataTemplate DataType="{x:Type models:PartModel}">
<StackPanel Orientation="Horizontal">
<Image Source="/Abtech.Spares.UI;component/Media/Graphics/motherboard_enabled_96x96.png"
Height="16"
Width="16"
Margin="0,0,3,0"/>
<Button x:Name="cmdTribal"
Margin="2,0,2,0"
Command="{Binding ElementName=ThisView, Path=DataContext.SelectTribalCommand}">
<Image Source="/Abtech.Spares.UI;component/Media/Graphics/abtech_triangle_blue_small.png"/>
</Button>
<TextBlock Text="{Binding PartNumber}"></TextBlock>
<TextBlock Text="{Binding Tribal.TribalNumber}"
Margin="3,0,0,3"
Foreground="Blue"/>
<TextBlock Text="-"
Margin="3,0,3,0"/>
<TextBlock Text="{Binding PartDescription}"></TextBlock>
</StackPanel>
</DataTemplate>
The PartModel has a property called Tribal, which is an instance of another model called TribalMode. On the TribalModel class is a property called TribalNumber. I can see the Tribal number displayed just fine when the data is loaded.
In the code behind after the data is loaded, I'm updating the tribal numbers, but the change doesn't show in the UI.
What's wrong here?
Everything makes sense in someone's mind
|
|
|
|
|
[UPDATE]
I implemented INotifyPropertyChanged in the TribalModel.TribalNumber, and it worked.
Everything makes sense in someone's mind
|
|
|
|
|
Hi All,
I have one question related to menu item design in wpf.
Actually i have one menu and menu items added to it.
The thing is i require the menuitems getting dropped while clicking the menu should have curved corner, that is borders having corner radius. I tried the follwing
<Menu Background="Blue" HorizontalAlignment="Center"
VerticalAlignment="Center" >
<MenuItem Background="Blue" Header="Menu1" ClipToBounds="True" Style="{StaticResource MenuItemStyle}" Foreground="White">
<Border HorizontalAlignment="Left" BorderBrush="Yellow"
BorderThickness="5" Background="Blue" CornerRadius="10" >
<Grid>
<Border Name="mask2" Background="White" CornerRadius="10"/>
<StackPanel Background="Blue">
<StackPanel.OpacityMask>
<VisualBrush Visual="{Binding ElementName=mask2}"/>
</StackPanel.OpacityMask>
<MenuItem Header="Value1"></MenuItem>
<MenuItem Header="Value2"></MenuItem>
<MenuItem Header="Value3"></MenuItem>
</StackPanel>
</Grid>
</Border>
</MenuItem> </Menu>
Now i am getting this menu items as having curved corners. But the standard square shaped background is also coming along with it. Here i am unable to paste the screen shot.
This code will show you what am tryign to say
How to get rid of the backgroud grey colored thing.
please help.
Thanks in advance.
|
|
|
|