Microsoft
Software
Hardware
Network
Question : Command:Click:Command is working fine for Button but its not working for Hyperlink
Commands:Click.Command is working fine for button but its not working when I do the same thing for hyperlink.My goal is when the user click on button or hyperlink I need to close the menu popup Its work fine for button but its not actually invoking the click command for hyperlink.We are using MVVM pattern for doing this.
//Button
<Button Grid.Row="0"
Style="{StaticResource MenuItemButton}"
Padding="4,3,3,3"
Commands:Click.Command="{B
inding ListLayoutCommand}"
Commands:Click.CommandPara
meter="Ver
tical">
//Hyperlink
<HyperlinkButton Style="{StaticResource MenuItemLinkButton}"
Padding="32,3,3,3"
Commands:Click.CommandPara
meter="nul
l"
Commands:Click.Command="{B
inding CloseMenuCommand}"
ToolTipService.ToolTip="{B
inding Description}"
Content="{Binding Name}"
NavigateUri="{Binding Value}"
TargetName="_blank">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Canvas Height="16" Width="16" Grid.Column="0">
<!-- TODO: replaces this canvas placeholder with an appropriate icon -->
</Canvas>
<TextBlock Grid.Column="1" VerticalAlignment="Center"
Text="{Binding Name}" Margin="10,0,0,0"/>
</Grid>
</HyperlinkButton>
//This code is working fine its actaully gets invoked when the user click on the button
public ICommand TileLayoutCommand
{
get;
private set;
}
//This is were we are appending with DelegateCommand in the constructor
this.TileLayoutCommand = new DelegateCommand<string>( this.OnLayoutClick );
//When the user clicks on button we are invoking
private void OnLayoutClick( string parameter )
{
var orientation = (Orientation) System.Enum.Parse( typeof( Orientation ), parameter, false );
this.layoutManager.ApplyLa
yout( orientation );
MenuService.CloseMenu();
}
But I have done the same think for hyperlink which is not working.
/// <value>An <see cref="ICommand"/> object.</value>
public ICommand CloseMenuCommand
{
get;
private set;
}
This is the property which is not getting triggered when the user clicks on the hyperlink.
this.CloseMenuCommand = new DelegateCommand<object>( p => Microsoft.Advertising.Cont
rols.MenuS
ervice.Clo
seMenu() );
Do I need to do some thing for invoking this method for the hyperlink.Could any one please help me out with this issue.
Answer : Command:Click:Command is working fine for Button but its not working for Hyperlink
</HyperlinkButton> , end tag is in wrong place. Try placing it top of <Grid> tag
Random Solutions
transpose rows and columns in Crystal Reports 9
Priv1.EDB & Priv1.stm - Disk Full
Preventing of copying certain file types via Group Policy
How can I automate Richcopy to copy files from a remote server to a local server?
desktop sharing using rdp
Fortigate 100A IPSEC VPN Draytek Vigor 2820 One way ping
Microsoft Exchange Management Shell script error - SBS2008
Backup & Restore in Express edition
Case of the missing InBox Outlook 2007
Linking Mysql having tinyint to Access