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
SQL 2008 does not send email
Intelligent Filter want to know which mails were blocked
Question about garbage collection - Which object is elligable for GC
unable to do trace route "tracert" within our network
Why am I getting a blank page on this code?
mysql upgrade 4.1 to 5.1
why appendTo jquery is not working
operation on JTable
visiting New York for the first time, what should I do and what's the must see's?
Sync between BIND and Microsoft DNS