|
Hi,
I am developing customized WPF Tabcontrol. I need to customize the collection Editor which pops up for Items Collection. In the customized collection Editor, I need my customized 'myTabItem', also I need to hide the existing TabItem in the collection.
How can I get this behaviour.
Thanks in advance,
vinod
|
|
|
|
|
I don't think you can currently customize the designers for standard WPF controls.
You can extened the current TabControl and create a designers.
This Code Project article covers creating a designers for WPF controls.
http://www.codeproject.com/KB/WPF/XPlorerBar2.aspx[^]
modified 27-Feb-21 21:01pm.
|
|
|
|
|
|
I recently created a configurable image rotator using Silverlight 2 and C#. I want to post it on Code Project, but I feel like it needs a good solid code review first...and of course whatever changes fall out of that. I was hoping someone here might be willing to take the time to do this for me as I don't have any good Silverlight resources to call on.
My major area of concern is how slow the control is loading on the page. I'm doing a handful of asynchronous calls, building a list of image controls before rendering the parent control which contains them. I'm wondering if this is not the optimal way. Or maybe it just needs to be tweaked a little. Any comments would be truly appreciated. As soon as I feel I can share something worth sharing, I will get this up on Code Project in both C# and VB.
http://www.anothercodesite.com/Blog/[^]
Thank you,
Troy Johnson
|
|
|
|
|
Hey folks,
Just hoping for some advice with a big project I'm creating the styling for in WPF. I've created a ResourceDictionary which I link to all buttons etc via and ApplicationDefinition file, but this project has ten+ project files within the solution so is an ApplicationDefinition file in each project the best way to go about this?
Hope that makes sense!
Becky
|
|
|
|
|
Do you mean you have created a "typed style" like:
<Style TargetType="{x:Type Button}"><br />
...<br />
</Style>
A resource dictionary does not target types the styles contained within the resource dictionaries do.
Project files also don't really make any difference. If these project files are all part of the same solution a style loaded into the application will apply to any buttons in the UI irrespective of the project (dll) they reside in.
Is this a composite application by any chance?
|
|
|
|
|
Sorry yes a typed style within a Resource Dictionary. My problem is that I understand putting the ResourceDictionary reference into an App.xaml file which means that then all those UIs within that project will then be affected by the style, but I need this to affect the entire solution (over multiple projects). Is there a way to create an App.xaml-like file that is solution-wide?
Thanks for the reply!
Becky
|
|
|
|
|
The short glib answer is no!
A single application (that loads the app.xaml and consequently the linked resource dictionaries) can be made up of multiple projects. A project in a solution is simply a dll. When a project is built it outputs a single dll or exe file. So one or more of those project may well be in the same application.
Would it be fair to assume that the solution your talking about actually contains multiple applications?
One thing you could do is move all of your styles into a single dll you can then put something like this in your app.xaml file in order to load all of the resource dictionaries and styles into each of the applications your trying to style ...
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/YourCompanyName.WPF.Styles;component/YourResourceDictionary.xaml" />
</ResourceDictionary.MergedDictionaries>
This xaml file will of course contain one or more resource dictionaries. You could separate them into control for instance so you might have button.xaml, combobox.xaml etc ...
Then you just need to include a reference to this style project in each of the applications in the solution and you should be good to go.
Let me know if this is unclear and I'll try to put a demo together ...
|
|
|
|
|
I've made that demo solution for you but I can't upload it till I get home as I don't have access to my personal server from work ...
watch this space!
|
|
|
|
|
That would be wonderful, thank you
So far I've created a new project in this solution named Styles which holds my style xaml files along with an App.xaml. This App.xaml I've got each of the style xaml files named under MergedDictionaries:
<ResourceDictionary><br />
<ResourceDictionary.MergedDictionaries><br />
<ResourceDictionary Source="Styles.xaml" /><br />
</ResourceDictionary.MergedDictionaries><br />
</ResourceDictionary>
Then in each of my other projects in the solution I've referenced the Styles project with a project Reference (the one in properties when you right-click on the project name)
Is that all I need to do - I'm trying to avoid touching the UIs themselves and I wasn't sure if you meant I need an App.xaml in each of the projects/dlls or if the project references are enough?
Thanks so much for your help!
Becky
|
|
|
|
|
I wouldn't call it App.xaml in the Styles project as that is really a reserved name for a file in an actual WPF application. Maybe use something like MainDictionary.xaml instead?
Also only reference the Styles project from the project(s) that build into the executable(s).
Then in each of your App.xaml files in the project(s) that build into the executable(s) you will need to reference the MainDictionary.xaml resource dictionary in the Styles project using the same syntax you have detailed.
<ResourceDictionary><br />
<ResourceDictionary.MergedDictionaries><br />
<ResourceDictionary Source="/YourCompanyName.WPF.Styles;component/MainDictionary.xaml" /><br />
</ResourceDictionary.MergedDictionaries><br />
</ResourceDictionary>
Sounds like your on the right track to me!
|
|
|
|
|
Your suggested MainDictionary.xaml is still supposed to be an ApplicationDefinition file rather than a Page though isn't it? Or is it supposed to be something else?
Thanks again!
Becky
|
|
|
|
|
Nope, its just a Page ...
The Styles project (dll) is little more than a repository of styles that applications can load and consume.
|
|
|
|
|
Thanks all, especially Jammer for providing the clue to my problem.
I was struggling and searching forums for days with a similar problem. On a number of forums it was said to set the build action of style.xaml file to Resource rather than Embedded Resource or Page. Since I did not get past error messages with either of the latter, I did change it to Resource and got the pack URI source format to work for some other resource dictionaries that were set to Resource, but not my main styles file. All these files were in the same subfolder in another project. For the life of me I still cannot figure out why one would work and another would not both in the same project called by the same project, all build actions set to Resource.
But if you are getting the message about Missing XmlNamespace, Assembly, or ClrNamespace in Mapping instruction (even though you know that these have been set correctly), then changing the build action from Resource to Page seems to make it work.
I think this may actually be a bug in VS2008. When I turn build action back to Resource (to capture the error message for this forum) it still loads fine. Even REbuilding versus building makes it work just fine. It is the exact same state I was in before for days that would not work.
|
|
|
|
|
Just for clarity when I create a Styles project, as you have done, I create a project of type Class Library. Then manually add in references to PresentationCore, PresentationFramework and WindowsBase.
|
|
|
|
|
Sorry ignore the last question - I was thinking the Styles project needed its own Application.xaml but it doesn't, instead it merges the style xaml files into one main dictionary so that the projects have a central dictionary to reference in their own respective Application.xaml files.
It's definitly a Friday - brain's gone home for the weekend already!
Becky
|
|
|
|
|
Your bang on the money there ...
|
|
|
|
|
The ResourceDictionary Source="" line is what I'm having trouble with as I'm breaking it down to:
Source="/YourCompanyName.SolutionName.Styles;component/MainDictionary.xaml"
Sure this is something daft I'm missing...
|
|
|
|
|
The bit before ;component is the name of the dll so the solution name has no bearing on this ...
So in a solution called MySolution there is a project called Styles containing a MainDictionary.xaml file in the project root (not in a subdirectory in the project your line would be:
Source="/Styles;component/MainDictionary.xaml"
If I did this the line would look something like:
Source="/JamSoft.SampleSort.Styles;component/MainDictionary.xaml"
If MainDictionary.xaml was actually in a subdirectory of the Styles project called SubDirectory1 the line would be:
Source="/JamSoft.SampleSort.Styles;component/SubDirectory1/MainDictionary.xaml"
I've uploaded the demo solution I made for you yesterday. You can get it here:
http://www.jammer.biz/downloads/WPFStylesApp1.zip[^]
I think your assuming the solution has more prominence than it does. I think of it as merely a way to link projects together in a single loadable group. The projects themselves could have absolutely no relation to each other, if that is the case it would be odd to have them in the same solution but thats another topic entirely!
|
|
|
|
|
Got it working! The demo was brilliant, thank you so much. When I have the App.xaml in the other projects it all works brilliantly, but now I have the problem of the projects which are Class Librarys not accepting App.xaml Application Definitions. I've tried the Themes/generic.xaml with a link to the MainDictionary but its not working.
Thanks very much for your help - would have been struggling for days!
Becky
|
|
|
|
|
If you think about it what your seeing makes perfect sense ...
How can a class library have an application definition file? Its NOT an application, its a class library ...
|
|
|
|
|
Yep, I spent most of yesterday trying to work out a way to avoid linking to the MainDictionary in all the xaml's I need the styling for, but there doesn't seem to be a way with it being a Class Library.
Working though
|
|
|
|
|
So what's in these dll's? Do the dll's provide views in the app?
|
|
|
|
|
Hi,
I have 3D cube which I want to move anywhere on screen on mouse move or mouse click. As whenever I tried to move it using mouse it rotates around some point (origin).
Is there any method to move this point (origin) anywhere else on screen.
e.g. in this example of a 3D book (www.codeproject.com/KB/WPF/3D-BookWriter.aspx) if you reduce the size of book (by holding right click on black portion and dragging it to left) and try to move it around then you will see it rotates around some point.
I just want to move it to say Bottom Right corner of screen.
Thanks for any help in advance.
Regards,
Parag
|
|
|
|
|
In my datagrid the date is displayed with time , how to format it and display in dd/MM/yyyy format . Help me please
|
|
|
|