I'm using a simple RadMenu and I am having a bit of trouble getting it to look correctly in the application.
It seems to be adding a small padding area to the surrounding the first menu item. (I've attached an image of how it renders in the application)
Here is the XAML:
<
DockPanel
Height
=
"40"
>
<
telerik:RadMenu
Height
=
"40"
Width
=
"100"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Center"
FlowDirection
=
"RightToLeft"
IconColumnWidth
=
"0"
Padding
=
"0"
Margin
=
"0"
>
<
telerik:RadMenuItem
Width
=
"100"
Header
=
"Menu"
Click
=
"RadMenuItem_Click"
HorizontalAlignment
=
"Right"
Margin
=
"0,0,-2,0"
Height
=
"40"
>
<
telerik:RadMenuItem
Header
=
"Main"
Height
=
"40"
/>
<
telerik:RadMenuItem
Header
=
"Alarms"
Height
=
"40"
/>
<
telerik:RadMenuItem
Header
=
"Configuration"
Height
=
"40"
/>
<
telerik:RadMenuItem
Header
=
"Exit"
Height
=
"40"
/>
</
telerik:RadMenuItem
>
</
telerik:RadMenu
>
</
DockPanel
>
Also, I don't want the arrow icon to appear, but I don't seem to be able to get rid of it.
I'm using the Windows8Touch theme.
Any help would be appreciated.
Sir,
I have created menu with sub menu.But while i click on
menu,the sub menu is opening just right of that menu.I want to open
below and sub menu letter alignment should middle.If you make template
Grid Horizontal Alignment="left",then it is opening just below it properly but letter alignment becoming left.I want letter
alignment should be middle.Here i have attached my sample project link .If there is way to solve this,please help me.
https://drive.google.com/a/aisofttech.com/file/d/0Bz9Sv7mmLtkeeFBGTXB1OFVNTnM/view?usp=sharing​
I am following the documentation guide Binding to Dynamic Data with one change, the RadMenu.ItemContainerStyle is set from code and not from XAML.
_menu =
new
RadMenu();
var s = Application.Current.Resources[
"MenuItemStyle"
]
as
Style;
if
(s !=
null
)
{
_menu.ItemContainerStyle = s;
}
The XAML template matches the example, expect for the name of the nested items to match the class used to construct the menu items:
<
ResourceDictionary
xmlns
=
"http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:telerik
=
"http://schemas.telerik.com/2008/xaml/presentation"
xmlns:local
=
"clr-namespace:Anvil.Desktop.Windows8"
>
<
Style
x:Key
=
"MenuItemStyle"
TargetType
=
"telerik:RadMenuItem"
>
<
Setter
Property
=
"Header"
Value
=
"{Binding Text}"
/>
<
Setter
Property
=
"ItemsSource"
Value
=
"{Binding Items}"
/>
<
Setter
Property
=
"Icon"
Value
=
"{Binding IconUrl}"
/>
<
Setter
Property
=
"IconTemplate"
>
<
Setter.Value
>
<
DataTemplate
>
<
Image
Source
=
"{Binding}"
Stretch
=
"None"
/>
</
DataTemplate
>
</
Setter.Value
>
</
Setter
>
</
Style
>
</
ResourceDictionary
>
The resource dictionary is merged and available in the merged resources but the menu items are not rendered as in the with_itemcontainerstyle_set.png attachment and when removing the style setting code:
_menu =
new
RadMenu();
var s = Application.Current.Resources[
"MenuItemStyle"
]
as
Style;
if
(s !=
null
)
{
// _menu.ItemContainerStyle = s;
}
the class names of the menu items are displayed as in without_itemcontainerstyle_set.png
Any suggestions?
Hi team,
I find the pop-up containing the RadMenuItem is always aligning to the right against the clicked parent Menu Item. I want to it be automatically detect the boundary, just like the context menu windows desktop. Any solutions?
Wishes,
Jingfei
<
telerik:RadDropDownButton
Grid.Column
=
"0"
HorizontalAlignment
=
"Right"
VerticalAlignment
=
"Top"
Margin
=
"0,5,25,0"
Content
=
"Actions"
Width
=
"100"
>
<
telerik:RadDropDownButton.DropDownContent
>
<
telerik:RadContextMenu
HorizontalAlignment
=
"Left"
Margin
=
"0,0,0,0"
VerticalAlignment
=
"Top"
>
<
telerik:RadMenuItem
Header
=
"New Project"
IsTabStop
=
"False"
>
<
Grid
Width
=
"300"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Text
=
"Project No:"
Grid.Row
=
"0"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
TextBox
Name
=
"newProjectNo"
Grid.Row
=
"0"
Grid.Column
=
"1"
HorizontalAlignment
=
"Left"
Width
=
"100"
Margin
=
"0,2,0,2"
TabIndex
=
"1"
IsTabStop
=
"True"
VerticalAlignment
=
"Top"
></
TextBox
>
<
TextBlock
Text
=
"Applicant:"
Grid.Row
=
"1"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
telerik:RadAutoCompleteBox
Name
=
"newMuniCode"
Grid.Row
=
"1"
Grid.Column
=
"1"
HorizontalAlignment
=
"Left"
Margin
=
"0,2,0,0"
TabIndex
=
"2"
IsTabStop
=
"True"
Width
=
"200"
VerticalAlignment
=
"Top"
/>
<
TextBlock
Text
=
"Project Engineer:"
Grid.Row
=
"2"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
telerik:RadComboBox
x:Name
=
"ProjectEngineerSelection"
Grid.Row
=
"2"
Grid.Column
=
"1"
Margin
=
"0,2,0,0"
TabIndex
=
"3"
IsTabStop
=
"True"
ClearSelectionButtonVisibility
=
"Visible"
ClearSelectionButtonContent
=
"Show all"
DisplayMemberPath
=
"DisplayName"
ItemsSource
=
"{Binding ProjectEngineers}"
SelectedItem
=
"{Binding SelectedEngineer, Mode=TwoWay}"
/>
<
TextBlock
Text
=
"Project Manager:"
Grid.Row
=
"3"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
telerik:RadComboBox
x:Name
=
"ProjectManagerSelection"
Grid.Row
=
"3"
Grid.Column
=
"1"
Margin
=
"0,2,0,0"
TabIndex
=
"4"
IsTabStop
=
"True"
ClearSelectionButtonVisibility
=
"Visible"
ClearSelectionButtonContent
=
"Show all"
DisplayMemberPath
=
"DisplayName"
ItemsSource
=
"{Binding ProjectManagers}"
SelectedItem
=
"{Binding SelectedManager, Mode=TwoWay}"
/>
<
TextBlock
Text
=
"NYC Project?"
Grid.Row
=
"4"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
CheckBox
x:Name
=
"NycProjectCheckBox"
Grid.Row
=
"4"
Grid.Column
=
"1"
Margin
=
"0,2,0,0"
IsTabStop
=
"True"
TabIndex
=
"5"
/>
<
TextBlock
Text
=
"NYC Service Area:"
Grid.Row
=
"5"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
telerik:RadComboBox
x:Name
=
"NycServiceAreaSelection"
Grid.Row
=
"5"
Grid.Column
=
"1"
Margin
=
"0,2,0,0"
TabIndex
=
"6"
IsTabStop
=
"True"
IsEnabled
=
"{Binding IsChecked, ElementName=NycProjectCheckBox }"
ClearSelectionButtonVisibility
=
"Visible"
ClearSelectionButtonContent
=
"Show all"
DisplayMemberPath
=
"DisplayName"
ItemsSource
=
"{Binding NycServiceAreas}"
SelectedItem
=
"{Binding SelectedNycServiceArea, Mode=TwoWay}"
/>
<
telerik:RadButton
Grid.Row
=
"6"
Grid.Column
=
"0"
Grid.ColumnSpan
=
"2"
Content
=
"Create Project"
HorizontalAlignment
=
"Center"
Height
=
"Auto"
Margin
=
"0,10,0,0"
VerticalAlignment
=
"Top"
TabIndex
=
"7"
IsTabStop
=
"True"
Width
=
"100"
Command
=
""
/>
</
Grid
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
Header
=
"Copy Project"
IsTabStop
=
"False"
>
<
Grid
Width
=
"200"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"Auto"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"25"
/>
<
RowDefinition
Height
=
"*"
/>
</
Grid.RowDefinitions
>
<
TextBlock
Text
=
"New Project No:"
Grid.Row
=
"0"
Grid.Column
=
"0"
Margin
=
"0,2,5,0"
/>
<
telerik:RadMaskedTextInput
Name
=
"copyProjectNo"
Grid.Row
=
"0"
Grid.Column
=
"1"
Mask
=
"0000-00-00"
HorizontalAlignment
=
"Left"
Margin
=
"0,0,0,0"
VerticalAlignment
=
"Top"
/>
<
telerik:RadButton
Grid.Row
=
"1"
Grid.Column
=
"0"
Grid.ColumnSpan
=
"2"
Content
=
"Copy Project"
HorizontalAlignment
=
"Center"
Height
=
"Auto"
Margin
=
"0,10,0,0"
VerticalAlignment
=
"Top"
Width
=
"100"
Command
=
""
/>
</
Grid
>
</
telerik:RadMenuItem
>
<!--<telerik:RadMenuItem Header="{Binding CurrentHeader}"-->
<
telerik:RadMenuItem
IsTabStop
=
"False"
Header
=
"Cost Increase"
IsEnabled
=
"{Binding CurrentProjectIsNyc}"
Command
=
""
>
</
telerik:RadMenuItem
>
<
telerik:RadMenuItem
IsTabStop
=
"False"
Header
=
"99 Project"
IsEnabled
=
"{Binding CurrentProjectIsNyc}"
Command
=
""
>
</
telerik:RadMenuItem
>
</
telerik:RadContextMenu
>
</
telerik:RadDropDownButton.DropDownContent
>
</
telerik:RadDropDownButton
>
01.
<
telerik:RadMenu
Grid.Row
=
"2"
Grid.Column
=
"1"
Width
=
"40"
HorizontalAlignment
=
"Right"
Background
=
"Transparent"
ClickToOpen
=
"True"
>
02.
<
telerik:RadMenuItem
Header
=
""
Width
=
"40"
Height
=
"40"
ToolTip
=
"Settings"
>
03.
<
telerik:RadMenuItem.Icon
>
04.
<
Image
x:Name
=
"btnSetting"
Source
=
"Resources/setting.png"
Stretch
=
"UniformToFill"
>
05.
</
Image
>
06.
</
telerik:RadMenuItem.Icon
>
07.
<
Trigger
Property
=
"IsMouseOver"
Value
=
"true"
>
08.
<
Setter
TargetName
=
"btnSetting"
Property
=
"Source"
Value
=
"Resources/setting-hover.png"
></
Setter
>
09.
</
Trigger
>
10.
</
telerik:RadMenuItem
>
11.
</
telerik:RadMenu
>