I just installed vs2013 and I carried a WPF project, previous developed with VS2010, under this environment. Happens to me a very strange thing that obviously does not happen with 2010 .... I have my own custom control that defines a runtime URI to a dictionary ... the strangeness lies in the fact that in the code of xaml page when i define the use of my control, i've got the error reported in subject... but the strangest thing is that if i start the dubug, everything works fine and the style is correctly applied .... someone has an idea?
the code look like that :
the custom control
publicclass myListView : ListView
// ... some dependency propertyprotectedoverridevoid OnInitialized(EventArgs e)
Uri uri = new Uri("Skins\\myDictionary.xaml", UriKind.Relative);
dictionary = Application.LoadComponent(uri) as ResourceDictionary;
//... rest of codebase.OnInitialized(e);
the xaml page
Title="MainWindow" Height="350" Width="525">
<!-- the editor tell me that can t find the Skins/myDictionary.xaml -->
P.S. The custom control is an external dll included in Reference...it's one of my several generic object that i use in several solution
I believe is is probably a bug in VS where is the xaml is too complex and it fails to render it. As irritating as it is I have never bothered to try and resolve the issue as it rarely happens and the resolution would probably take too much time anyway.
I now try and keep a views complexity down
Never underestimate the power of human stupidity
When I run it, I see Resize handles on all 4 corners of the textbox, and I can click & drag. The problem is that I cannot edit the text in the text box because the IsHitTestVisible property on the textbox Is False.
Set IsHitTestVisible = true and you can no longer drag & resize.
What I'd like is to be able to both drag/drop AND edit.
i am displaying the result of this linq query in a wpf datagrid
var v = from p in _context.EXAMENS_VALEURs
join b in _context.EXAMENS_TYPES_VALEURs on p.EXV_ID_VALEUR_TYPE equals b.ID_EXAMEN_TYPE_VALEUR
join c in _context.EXAMENS_TYPES_GROUPEs on b.EXTV_ID_GROUPE equals c.ID_EXAMEN_TYPE_GROUPE
ID = p.ID_EXAMEN_VALEUR,
Designation = b.EXTV_DESIGNATION,
Groupe = c.EXTG_DESIGNATION,
Valeur = p.EXV_VALEUR
((CollectionViewSource)this.FindResource("ExamensView")).Source = v.ToList();
I assume your model implements INotifyPropertyChanged Interface. In your VM, you can subscribe to the model's property changed event, and then check if the IsChecked property is the one being changed. If the instance of the model is inside a collection (I assume it is as this is a hierarchicaltemplate), you will need to subscribe to the collection's collection changed event, then inside that method, you subscribe to each instance's property changed event.
Something like this
Items.CollectionChanged += ItemsChanged;
privatevoid ItemsCHanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
if(e.NewItems != null)
foreach(Item item in e.NewItems)
//Subscribe to property changed
item.PropertyChanged += ItemChanged;
if (e.OldItems != null)
foreach (Item item in e.OldItems)
//Ensure you unsubscribe
item.PropertyChanged -= ItemChanged;
privatevoid ItemChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
if(e.PropertyName == "IsChecked")
//Do work here
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
I think the best thing to do is to convert the xaml headers, like DataGridTextColumn to equivalent classes in C#. The red items in xaml are the properties for that class. For example, the Header and IsReadOnly is most likely in the original DataGridTextColumn class as additional properties. Most xaml headers can be located as similar class names. Finally, the binding could be changed to reference the DataGrid's name instead.
Although answered in the above post, I will say this:
To me, the word "service" screams static class. What use is a service if you have to create it and register all your views every time you are in a different scope? I would create the service class as a static item and register views on it, that way the registered views are available to the entire application without having to recreate the registry.
You would have to use some kind of initialization logic to set up the service (register all the available views) that should be called during the startup process of your program.