let me know I am in the process of learning the prism structure and I have already come together. But I was thinking about how to create toolbars (and context menus), where each module can register its button.
For this example, I want all buttons to be located in the same toolbar control which is located in my shell. The toolbar Note that the collection of typeworkwork must be a more solid type again if this is the correct solution. One way to register image buttons in my I call this method from my The problem is that how can I control when I should delete these buttons again. If I navigate a view in any other module (and sometimes in other modules in the same module), then I want to hide these module-specific buttons again. Do you have any suggestions on doing this? Am I delivering this problem in a wrong way, or can I modify it already? How did you solve this problem? I do not include the Then definitely change Add Now you can force the As an added bonus, you can also: itemsSource is the property of a
toolbar item in the
observation list & lt; Framework Element & gt; is built into a visual model. Elements can be added to this collection using a
ToolBarRegistry service, it is ViewModel:
public square ShellViewModel { Private IToolBarRegistry _toolBarRegistry; Personal observable collection & lt; Framework Element & gt; _toolBarItems; Public ShelvesModel () {_toolBarItems = New Observational Collection & lt; Framework Element & gt; (); _toolBarRegistry = new toolbarwid (this); } Public Observable Collection & lt; Framework Element & gt; ToolBarItems {get {return _toolBarItems; }}}
ToolBarRegistry is:
Registered Public Zero ImageButton (String ImageSource, ICMMand Command) {var icon = new bitmap image (new URI (image source)); Var img = new image (); Img.Source = icon; IMG Wideth = 16; Var BTN = New Button (); BTN Content = img; BTN Command = command; _shellViewModel.ToolBarItems.Add (btn); }
order module and buttons appear properly. So far so good.
button in
observable collection . Instead, think about this approach:
Create ViewModel for toolbar button
class toolbar buttonviewmodel: INotifyPropertyChanged {// INotifyPropertyChanged implementation provided by you for public string ImageSource {get; Set; } Received the public ICommand command { Set; } Get Public Child Available (Receive; Set; }}
ToolBarItems to this type of archive.
ToolBarButtonViewModel to your
ShellView ,
DataTemplate and
ItemsSource to whatever your The control of the toolbar is in the collection of ViewModels, for example:
& lt; Datatomplate & gt; & Lt; Button command = "{binding command}" & gt; & Lt; Button.Content & gt; & Lt; Image source = "{binding image source}" /> & Lt; /Button.Content> & Lt; / Button & gt; & Lt; / DataTemplate & gt;
button. Specialty to
isvizible to solve your immediate problem.
ToolBarButtonViewModel
On update
CustomNavigationService ) and Decide what to do in this
Comments
Post a Comment