1

Topic: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

C WPF is very little familiar, but here would get like a simple problem. There is XAML in which  a following part, while only with one element <local:Toolbox ItemSize = "80, 60"> <ItemsControl. Items> <Grid> a quantity of elements </Grid> <ItemsControl. Items> </local:Toolbox> It trebuetsja/is wanted to move an element in ResourceDictionary. With copying of problems is not present but how to use this element from resources? <local:Toolbox ItemSize = "80, 60"> <ItemsControl. Items> <??? = "{StaticResource a name}"> <ItemsControl. Items> </local:Toolbox> That that does not manage to be found yet. It is similar necessary as that absolutely on another to do. It is possible to throw from the code, but it as that not on WPF th turns out.

2

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> That that does not manage to be found yet. It is similar necessary as that absolutely on another to do. AN> it is possible to throw from the code, but it as that not on WPF th turns out. How to: Make Data Available for Binding in XAML... <<RSDN@Home 1.3.108 alpha 5 rev. 56>>

3

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, _Raz _, you wrote: _R _> Hello, AlexNek, you wrote: AN>> That that does not manage to be found yet. It is similar necessary as that absolutely on another to do. AN>> it is possible to throw from the code, but it as that not on WPF th turns out. _R _> How to: Make Data Available for Binding in XAML that with the link not absolutely clearly, where  that in the given specific case?

4

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> That with the link not absolutely clearly, where  that in the given specific case? In ItemsSource <Window. Resources> <x:Array x:Key = "MyArray" Type = "system:String"> <system:String> aaa </system:String> <system:String> bbb </system:String> <system:String> ccc </system:String> </x:Array> </Window. Resources> <ListBox ItemsSource = "{StaticResource MyArray}"/>... <<RSDN@Home 1.3.108 alpha 5 rev. 56>>

5

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, _Raz _, you wrote: _R _> Hello, AlexNek, you wrote: AN>> That with the link not absolutely clearly, where  that in the given specific case? _R _> in ItemsSource _R _> _R _> <Window. Resources> _R _> <x:Array x:Key = "MyArray" Type = "system:String"> _R _> <system:String> aaa </system:String> _R _> <system:String> bbb </system:String> _R _> <system:String> ccc </system:String> _R _> </x:Array> _R _> </Window. Resources> _R _> <ListBox ItemsSource = "{StaticResource MyArray}"/> _R _> So all elements in one file (resources at me in a separate file) are not necessary to me. It would be desirable to save only one element of the list separately. This element difficult enough object, it would be desirable to have it separately. Besides, the identical object should be accessible from  and from the code by name. In the beginning objects "are outlined" on  from , and after all the collection is recovered from a file on object name and parameters.

6

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> C WPF is very little familiar, but here would get like a simple problem. AN> there is XAML in which  a following part, while only with one element AN> AN> <local:Toolbox ItemSize = "80, 60"> AN> <ItemsControl. Items> AN> <Grid> AN> a quantity of elements AN> </Grid> AN> <ItemsControl. Items> AN> </local:Toolbox> AN> AN> It trebuetsja/is wanted to move an element in ResourceDictionary. AN> With copying of problems is not present but how to use this element from resources? AN> AN> <local:Toolbox ItemSize = "80, 60"> AN> <ItemsControl. Items> AN> <??? = "{StaticResource a name}"> AN> <ItemsControl. Items> AN> </local:Toolbox> AN> AN> That that does not manage to be found yet. It is similar necessary as that absolutely on another to do. AN> it is possible to throw from the code, but it as that not on WPF th turns out. The answer is found - as it would be desirable it is impossible When you define an arbitrary Control in Resources, you can use it in the future in Control which have property Content and derived from Control class.

7

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> Hello, AlexNek, you wrote: AN>> C WPF is very little familiar, but here would get like a simple problem. AN>> there is XAML in which  a following part, while only with one element AN>> AN>> <local:Toolbox ItemSize = "80, 60"> AN>> <ItemsControl. Items> AN>> <Grid> AN>> a quantity of elements AN>> </Grid> AN>> <ItemsControl. Items> AN>> </local:Toolbox> AN>> AN>> It trebuetsja/is wanted to move an element in ResourceDictionary. AN>> With copying of problems is not present but how to use this element from resources? AN>> AN>> <local:Toolbox ItemSize = "80, 60"> AN>> <ItemsControl. Items> AN>> <??? = "{StaticResource a name}"> AN>> <ItemsControl. Items> AN>> </local:Toolbox> AN>> AN>> That that does not manage to be found yet. It is similar necessary as that absolutely on another to do. AN>> it is possible to throw from the code, but it as that not on WPF th turns out. AN> the answer is found - as it would be desirable it is impossible AN> AN> When you define an arbitrary Control in Resources, you can use it in the future in Control which have property Content and derived from Control class. AN> As it appeared the answer it is incorrect https://docs.microsoft.com/en-us/dotnet … -extension <local:Toolbox ItemSize = "80, 60"> <ItemsControl. Items> <StaticResource ResourceKey = "Name"/> </ItemsControl. Items> </local:Toolbox>

8

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> C WPF is very little familiar, but here would get like a simple problem. Esteem about data-binding, data-template and MVVM. To you already prompted the right answer - to use ItemsSource and binding. Items is special (convenient) xaml-only a method of creation of contents, without usage data-/control-template it is explicit. You add one element, Grid, in apparently custom control Toolbox. In WPF custom controls are very rarely necessary, and if are necessary, at them, as a rule, appear  dependency property. Most likely you can use ItemControl (c one element - ContentControl). Understanding MVVM it is possible to organize data structures untied from representation,  you will not have at all such strange task. Simply create UserControl c it Grid inside. Define data-template and assign ContentControl. Content through . AN> It trebuetsja/is wanted to move an element in ResourceDictionary. It would be interesting to learn what for. The task that "simple" (sounds simply), but you most likely solve any problem not that method.

9

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, Sinatr, you wrote: S> Most likely you can use ItemControl (c one element - ContentControl). Understanding MVVM it is possible to organize data structures untied from representation,  you will not have at all such strange task. Simply create UserControl c it Grid inside. Define data-template and assign ContentControl. Content through . AN>> It trebuetsja/is wanted to move an element in ResourceDictionary. S> It would be interesting to learn what for. The task that "simple" (sounds simply), but you most likely solve any problem not that method. Generally that is required the specialized editor very bearing a faint resemblance Vizio with possibility of saving and reading from a file. One element in  it now. The element rather difficult on a picture and afterwards will be change. In a file the link to an element should register only, the element will be is in application or can in additional . Using ResourceDictionary it is possible to create easily an element () both from the code and from . Well here like briefly. By the way, there was still a question. This   needs to be connected to  to application, there already there are some other elements. Here only the element a host becomes stupid in studio 2017. On the right on top should  the list of all WPF elements for connection from , and he in any way does not want to appear. Once appeared after  , and after already in any.

10

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

If who uses still ResourceDictionary - a useful reference https://msdn.microsoft.com/en-us/library/aa970069 (VS.85).aspx As it is necessary for me to use UserControl allocated in  . That 1. Resources should ' be declared ' in UserControl 2. It is necessary to use absolute  (component is a keyword, instead of a name) <UserControl. Resources> <ResourceDictionary> <ResourceDictionary. MergedDictionaries> <ResourceDictionary Source = "/; component/Resources/Shared.xaml"/> <ResourceDictionary Source = "/;component/Resources/DesignerItem.xaml"/> </ResourceDictionary. MergedDictionaries> </ResourceDictionary> </UserControl. Resources>

11

Re: [WPF] How to move <ItemsControl. Items> in ResourceDictionary

Hello, AlexNek, you wrote: AN> If who will use still ResourceDictionary - useful reference AN> https://msdn.microsoft.com/en-us/library/aa970069 (VS.85).aspx AN> As it is necessary for me to use UserControl allocated in  . AN> That AN> 1. Resources should ' be declared ' in UserControl AN> 2. It is necessary to use absolute  (component is a keyword, instead of a name) AN> AN> <UserControl. Resources> AN> <ResourceDictionary> AN> <ResourceDictionary. MergedDictionaries> AN> <ResourceDictionary Source = "/; component/Resources/Shared.xaml"/> AN> <ResourceDictionary Source = "/;component/Resources/DesignerItem.xaml"/> AN> </ResourceDictionary. MergedDictionaries> AN> </ResourceDictionary> AN> </UserControl. Resources> AN> On it all my errors did not end That earned it was necessary to rename the directory/Resources on/ResourcesXaml (though can also superfluous) and all pictures to install Build Action in Recource. In passing the error in the designer of studio was still found out - if the element at loading falls out with an error that studio falls out also. Therefore to load VPF TH elements for Vinforms it is better not in the designer, and in the code. Thus still we receive a bonus - rather normal error report. _userControl = new MyUserControl (); elementHost. Child = _userControl;