|
You can google how to configure MIME type for Silverlight. Let me know if you are still having this problem..
|
|
|
|
|
Hi!
I encounterd something weird!
Using the .net memory profiler, if i have a wpf button and hoover it, the number of undisposed instances increases dramatically.
Anyone here having the same problem?
Is it a problem or is it an error of the memory profiler?
BTW, neither the GC disposes these instances.
|
|
|
|
|
Can you post your XAML here. Just want to see exactly what you are doing.
Also, what version of Visual Studio are you using?
Any .NET services packs applied?
Which memory profiler?
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Simple XAML:
<Window x:Class="ButtonTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:command="clr-namespace:ButtonTest"
Title="Window1" Height="300" Width="300">
<Window.CommandBindings>
<CommandBinding
Command="{x:Static command:Stetics.uiCommand}"
Executed="CommandBinding_Executed"
CanExecute="CommandBinding_CanExecute"/>
</Window.CommandBindings>
<Grid>
<Button Height="50" Width="100" Command="{x:Static command:Stetics.uiCommand}"></Button>
</Grid>
</Window>
Code Behind:
namespace ButtonTest
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
{
}
private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
{
e.CanExecute = true;
}
}
}
Software installed:
VS 2008 TS + SP1 (.NET 3.5 + Sp1)
.NET Memory Profiler 3.1 (http://memprofiler.com/[^]
Coderush EXPRESS 3.2
GhostDOC
Action:
Enter and Leave the Button.
Undisposed items after 60 sec. : 2.191 -> this number can get real high after a few minutes
Hope that helps.
|
|
|
|
|
This is just what we need to repro.
Can you also post the Command Code.
This way we are using the exact code you are.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Nothing special in here either:
using System.Windows.Input;
namespace ButtonTest
{
public static class Stetics
{
public static RoutedUICommand uiCommand = new RoutedUICommand();
}
}
|
|
|
|
|
Thank you. I just want to be sure we have the same code as you do.
I'll run the tests on Monday at work and get back to you.
Thank you for raising this important question.
modified 27-Feb-21 21:01pm.
|
|
|
|
|
Hi Karl,
Did you have a chance to look at this issue?
I also ran into the same issue with ObservableCollection<T> class.
Simple test code like this:
while (true)
{
ObservableCollection<int> collection = new ObservableCollection<int>();
}
Will generate one undisposed instance of ObservableCollection<int>.SimpleMonitor per observable collection created.
best regards,
Alex.
|
|
|
|
|
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 ...
|
|
|
|