0

I am trying to find a way of making Modern UI WPF (MUI) logo clickable so I can initiate a web navigation to a certain page.

The idea is to change the MUI project the minimum necessary and not cause any dependency over my application.

The logo is defined in the ModernWindow style as follows:

<!-- logo (visible only when LogoData is not null) -->
<Border Grid.Column="2" Background="{DynamicResource Accent}" Width="36" Height="36" Margin="8,0"
        DataContext="{TemplateBinding LogoData}"
        Visibility="{Binding Converter={StaticResource NullToVisibilityConverter}, ConverterParameter=inverse}">
    <Path Data="{Binding}" Stretch="Fill" Fill="White" Width="24" Height="24" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>

How can I wire the click event on this border to my application ModernWindow instance?

Joey
  • 344,408
  • 85
  • 689
  • 683
Igor Kondrasovas
  • 1,479
  • 4
  • 19
  • 36

2 Answers2

0

The simplest and, as far as I'm concerned the best way to implement click in your case:

  1. Change your border by Button
  2. Change your button's Style and ControlTemplate to make it look as you need
  3. Define command binding to your view model, or implementation of Click event.
Mr.B
  • 3,484
  • 2
  • 26
  • 40
0
<Border ...>      
    ...
    <Border.InputBindings>
        <MouseBinding Command="{Binding Path=MyClickCommand}" MouseAction="LeftClick" />
    </Border .InputBindings>
</Border>
Fredrik
  • 2,247
  • 18
  • 21