dynamic - WPF - Redrawing a Context Menu when Items change? -


I have the items control in the ScrollViewer, and when items are greater than the ScrollViewer's width, they are put in ContextMenu And instead my problem as a dropdown is that when the context menu is filled for the first time, it saves, saves the size of the menu, and when the more commands are added / deleted, the red color does not . For example, in one panel there are 3 commands 1 and 1 is visible in the menu and the menu shows 2 commands and draws controls, but then if you change the size of the panel then 2 are visible and only 1 command In the menu, it does not eliminate that menu to eliminate the menu menu, or worse, if you want to remove the panel so that no order is shown and all 3 are in the menu, then it only shines Show Sh 2.

https://i193.photobucket.com/albums/z197 /Lady53461/ContextMenuRedraw.jpg

Here's my code:

  & lt; Button click = "dropdown menu" contact menu = "dropdown menu menu" & Lt; Button.ContextMenu & gt; & Lt; ContextMenu ItemsSource = "{Binding Path = Menu Compand}" Placement = "Down" & gt; & Lt; ContextMenu.Resources & gt; & Lt; Style TargetType = "{x: type menu item}" & gt; & Lt; Setter property = "command" value = "{binding path = command}" /> & Lt; Setter Property = "Visibility" value = "{Binding Path = IceWeible, Converter = {Static Resources Rev. Revolutionary Consumability}}" /> & Lt; / Style & gt; & Lt; /ContextMenu.Resources> & Lt; ContextMenu.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Text block text = "{binding path = display name}" /> & Lt; / DataTemplate & gt; & Lt; /ContextMenu.ItemTemplate> & Lt; / ContextMenu & gt; & Lt; /Button.ContextMenu> & Lt; / Button & gt;  

Code Back:

  Open the zoom dropdown menu to the context menu (Object Sender, ContextMenuEventArgs e) {button b = as the sender button; B.content menu.ISOpen = false; E.Handled = True; } Private Zero DropDownMenu_Click (Object Sender, RoutedEventArgs e) {Button B = Sender Button; ContextMenu cemenu = b.ContextMenu; If (CMNU! = Null) {cMenu.PlacementTarget = b; CMenu.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom; CMenu.IsOpen = True; }}  

I have tried to use invalid dignitaries and send an empty representative to render to render again, even then it does not work. I am using .NET 4.0.

Is there a collection of menu collections? If it is, then is it an observation?

If you bind a collection to ItemsControl , find that archive for INotifyCollectionChanged interface to ItemsControl It is necessary to implement the number of items in the collection has changed so that control can "redraw" automatically.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -