.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Sharon Maxwell
Post New Web Links

restyling menuitem

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :WPF
 

con blend stò modificando il template di default di menuitem per una mia applicazione, tutto regolare e tutto bene finchè non apro la mia ui con il menu sul designer di vs2010: mi ritrovo gli elementi del menu tutti molto allargati.

Ho notato che su blend la proprietà width del menuitem è "auto(250)" e quel 250 potrebbe essere proprio quel che visualizza VS! eseguendo l'appliccazione naturalmente tutto bene.

Ora, che cosa succede? c'è modo per far visualizzare correttamente anche il designer?


Roberto Pallucchini
*** Please mark as Answer, if this reply helps you***
*** Per favore Suggerisci come risposta, se la risposta ti è stata di aiuto***


View Complete Post


More Related Resource Links

Is it possible to put usercontrol in a menuitem?

  
I have a calendar usercontrol that I would like to put as a subitem of a menuitem. Is this possible? A c# example would be helpful if anyone knows the answer to this.   Thanks!

WPF MenuItem CommandParameter specifie in style not available on menu first open

  
I am specifying a context menu within the ControlTemplate of a TreeViewItem as follows:                                       <ContextMenu ItemsSource="{Binding Commands}"> <ContextMenu.ItemContainerStyle> <Style TargetType="MenuItem"> <Setter Property="Command" Value="{Binding Command}" /> <Setter Property="CommandParameter" Value="{Binding CommandParameter}" /> <Setter Property="Header" Value="{Binding Name}" /> <Setter Property="Icon" Value="{Binding Icon}" /> </Style> </ContextMenu.ItemContainerStyle> </ContextMenu> where Commands is a list of ICommandViewModels objects with the following signature: public interface ICommandViewModel { string Name { get; } Image Icon { get; } ICommand Command { get; set; } object CommandParameter { get; set; } } When the ContextMenu is op

MenuItem as a radio / options list

  
Is it possible to make a series of MenuItem's behave like a radio button list?
The effect that I want is the same as that in Windows Explorer under the View menu for List/Tiles/Details selection - a dot is placed against the selected item on the left hand margin and only one item may be selected at any one time.

I can set MenuItem.IsCheckable=true which will turn a MenuItem into a checkbox - that makes a tick.

I could make several MenuItems and add some logic such selecting one checkbox deselects the others - but it isn't the right visual effect. It makes ticks and not dots.

I tried adding radio buttons to the Menu but the (o) selector is contained within the right hand content of the MenuItem and is not rendered in the margin.

Any ideas?
tia.

Binding MenuItem.IsChecked to RichTextBox.SpellCheck.IsEnabled

  

I have the following deceleration of a rich text box:

 

  <RichTextBox 
    x:Key="rtfBox"
    SpellCheck.IsEnabled = "False"
    ContextMenuService.ShowOnDisabled="True"    
    ContextMenu="{StaticResource rtfBoxContextMenu}">    
  </RichTextBox>

 

And the context menu is defined as follows:

 

 

menuitem blend to vs2010 issue

  

hi all,

i using blend 4 to customize the default template for menuitem that i want to use for my application.
Now, i complete this task: i choose to edit the current menuitem template in blend, this generate the relative xaml code and i save, i load the ui in VS2010 designer the menuitems as been all expanded. I do not touch width property. Why? This is trouble a lot...

 


Roberto Pallucchini
*** Please mark as Answer, if this reply helps you***
*** Per favore Suggerisci come risposta, se la risposta ti è stata di aiuto***

menuitem blend to vs2010 issue

  

hi all,

i using blend 4 to customize the default template for menuitem that i want to use for my application.
Now, i complete this task: i choose to edit the current menuitem template in blend, this generate the relative xaml code and i save, i load the ui in VS2010 designer the menuitems as been all expanded. I do not touch width property. Why? This is trouble a lot...

 


Roberto Pallucchini
*** Please mark as Answer, if this reply helps you***
*** Per favore Suggerisci come risposta, se la risposta ti è stata di aiuto***

MenuItem using Command is disabled for no reason

  
Hi,

I have a Window (acting as an MDI) with a menu containing many Items which are linked to commands. When I start my application all menu items are enabled. When i click on one which opens a custom modal dialog, and then go back to the menu, ALL menu items that have commands are disabled :(

Ive read around and I think the problem is something to do with FocusScope and FocusManager.

When I open another window and click in a textbox then go back to the menu, the menu items are enabled.
Ive tried seeting FocusManager.IsFocusScope = True within the menu which didnt make any difference.

Any help would be appreciated as Ive spent a while on this and got nowhere. 

Regards
David



Invoking Command In WPF SUb MenuItem

  
<ListView.ContextMenu>
                    <ContextMenu>

                              <MenuItem Header="Flag(s)" ItemsSource="{Binding Path=LineItemFlags}" Command="{Binding AssignFollowupCommand}" 
                                  CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, 
                                    AncestorType={x:Type ContextMenu}}, Path=PlacementTarget}">
                            <MenuItem.ItemContainerStyle >
                                <Style TargetType="{x:Type MenuItem}">
                                    <Setter Prop

Adding a Command in a Dynamic MenuItem

  
Hello, and thank you for taking a look at this question.

I am developing my own Most Recent Used sub-menu. I have developed my main File Menu items (Open, Close, Save etc) in my XAML and included a binding for these to my commands which are defined in my ViewModel. These all work fine.

I have decided to save the file path and date into an XML file for simplicity. I can read this in and in my ViewModel I have a ListCollectionView property which exposes the XML elements. Still fine!

In my XAML I can bind my Recent Items sub-menu to the Filename item in my ListCollectionView without a problem, but I cannot seem to figure out how to bind each sub-menu item to a Command which will determine which file to open.

My XAML so far is as follows:

<Menu
            x:Name="MainMenu" Background="#FFFFFFFF" BorderBrush="#FF000000" Margin="0,0,0,2.723" Grid.ColumnSpan="2" d:LayoutOverrides="Height, GridBox">
            <MenuItem Header="_File">
                <MenuItem Header="_Open" InputGestureText="Ctrl+O" Command="{Binding Path=OpenCommand}"/>
                <MenuItem Header="_New" InputGestureText="Ctrl+N" Command="{Binding Path=NewCommand}"/>
                <MenuItem Header="_Close" InputGestureText="Ctrl+Q" Command="{Binding Path=CloseCommand}"/>
                <MenuItem Heade

Problems with Binding Icon in dynamic MenuItem

  

I'm don't understand when I use hardcoded
<MenuItem.Icon><Image Source="images\image.png"/></MenuItem.Icon>
all works fine, but when I use binding it doesn't work :( !!!

<XmlDataProvider x:Key="data">
<x:XData>
<
Items xmlns=""

When MenuItem.NavigateUrl is not set the MenuItemClick event isn't fired!

  
First of all... I must say "Very good Job guys!!!", this Adapters are great!
In the standard Menu control (without the CSS Friendly Adapter) when we setup menu items without setting the NavigateUrl property, the normal behavior is that at runtime clicking on menu item will fire the MenuItemClick server event.

Using the new CSSFriendly adapter, and leaving null the NavigateUrl property of the menu items, no server event is raised!

IMO this is an incoherent behavior.... do you agree?
Hot to fix this?

Thks.


MenuItem Click event handler not getting called from a HierarchicalDataTemplate EventSetter Style

  

I have a user control that contains another user control based on a button. When the button is clicked I have it show a context menu that is bound to a enumeration that shows a dynamic set of menu items. I use a HierarchicalDataTemplate to generate the MenuItems and use a style with an eventsetter to define a menu click handler to be called when any of the menu items are clicked. The context menu and its menu items gets displayed properly but the event handler is not getting called. Any ideas? Below is the section of the xaml where the user control is defined and below it is the code behind with the event handler.

Thanks! 

 

<Controls:WebcastButton x:Uid="videoConfigureButton" x:Name="videoConfigureButton" 
                   

When MenuItem.NavigateUrl is not set the MenuItemClick event isn't fired!

  
First of all... I must say "Very good Job guys!!!", this Adapters are great!
In the standard Menu control (without the CSS Friendly Adapter) when we setup menu items without setting the NavigateUrl property, the normal behavior is that at runtime clicking on menu item will fire the MenuItemClick server event.

Using the new CSSFriendly adapter, and leaving null the NavigateUrl property of the menu items, no server event is raised!

IMO this is an incoherent behavior.... do you agree?
Hot to fix this?

Thks.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend