c# - How do I access a UserControl resource from a .net class -


I'm trying to use a resource UserControl and TreeViewGroupItemTemplateSelector class I TreeViewGroupItemTemplateSelector do not have access to UserControl class within the class are having problems formatting I i Uri remains

PackageExplorer.xaml UserControl and the root name of the local assembly area, which includes the TreeViewGroupItemTemplateSelector class.

I'm having the following error:

Resource 'resource / packageexplorer.xaml' can not be detected

of the Instion During the URI

  Public Square TreeViewGroupItemTemplateSelector :. DataTemplateSelector {public override DataTemplate SelectTemplate (item item, DependencyObject container) {var configGroup = Items as IConfigurationGroup; If (configGroup == zero) return zero; Var Processing Area = New Resource Deduction (); SourceDictionary.Source = New Uri ("/ myAssembly; Component / Resources / MUSS Control.xml", UricKind.Relative Ossolute); If (configgroup.ItemType == type of reference (Sndrbpackej Confignietm)) as returns Risorsdsait [ "Rifresablhararikikldetapleptr"] Detataimet; Other resource resources ["DefaultHierarchicalDataTemplate"] DATA as a template template; }}}   

The XAML (snippet) looks like:

  & lt; UserControl.Resources & gt; & Lt; ResourceDictionary & gt; & Lt; ResourceDictionary.MergedDictionaries & gt; & Lt; ResourceDictionary & gt; & Lt; HierarchicalDataTemplate x: Key = "DefaultHierarchicalDataTemplate" datatype = "{x: Type localconfig: ConfigurationGroup}" ItemsSource = "{Binding Path = Items}" ItemTemplateSelector = "{StaticResource TreeViewGroupItemTemplateSelector}" / & gt; & Lt; HierarchicalDataTemplate x: Key = "RefreshableHierarchicalDataTemplate" datatype = "{x: Type localconfig: ConfigurationGroup}" ItemsSource = "{Binding Path = Items}" ItemTemplateSelector = "{StaticResource TreeViewGroupItemTemplateSelector}" / & gt;   

I have also tried to reach the resources shown below with the same result:

  sourceDictionary.Source = new URI ("/ resource / myUserControl Xaml ", Urickind, Relative and Ossolute);   

and:

  sourceDictionary.Source = new URI ("myUserControl.xaml", UriKind.RelativeOrAssolute);    

It is not clear what you are trying to achieve - but like That I think ..

If you are trying to load the entire user-control XAML file - as a resource

User Control XAML is not a 'Resource Dictionary' - I I'm not sure what is the error that may arise as

but just different things you can not find any 'Resource Dictionary' XAML in UserControl MergeDictionary can be used to merge. Resource - But keep that 'resource' on your own file - not load, full user control, hope that

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -