lepoco / lepoco/wpfui

Binding support to NotifyIcon

Open
#287 2 comments 0 reactions 1 assignee View on GitHub

@pomianowski is already working on this.

Since Jul 18, 2022.

controls enhancement
Dominant language
C#
Stars
9.6k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

I am creating an application that has dynamic tray icon (both icon and tooltip). So far I was able to do this using hardcodet. It would be cool to have such ability for wpfui. Also MenuItem commands are not working.

To Reproduce

        <ui:TitleBarHeader="{x:Static resx:Resources.AppTitle}">
            <ui:TitleBar.Tray>
                <ui:NotifyIcon 
                    FocusOnLeftClick="True"
                    MenuOnRightClick="True"
                    TooltipText="{Binding Test}"
                    Icon="{Binding TrayIcon}"
                >
                    <ui:NotifyIcon.Menu>
                        <ContextMenu>
                            <MenuItem Header="{Binding Test}" >
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <i:InvokeCommandAction Command="{Binding ShowApp}" PassEventArgsToCommand="True" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </MenuItem>
                            <Separator />
                           <MenuItem Command="{Binding ShowApp}" Header="{x:Static resx:Resources.OpenButton}" />
                        </ContextMenu>
                    </ui:NotifyIcon.Menu>
                </ui:NotifyIcon>
            </ui:TitleBar.Tray>
        </ui:TitleBar>

Expected behavior

  • Ability to bind Tooltip and Icon
  • Commands called

Desktop:

  • OS: Windows 10
  • .NET: net6.0
  • Version: 2.0.1

Additional context
Working Hardcodet taskabar icon

        <tb:TaskbarIcon
                    IconSource="{Binding TrayIcon}"
                    ToolTipText="{Binding TrayTooltip}"
                    LeftClickCommand="{Binding ShowApp}"
                    MenuActivation="RightClick" >
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
                    <MenuItem Command="{Binding ShowApp}" Header="{x:Static resx:Resources.OpenButton}" />
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>
        </tb:TaskbarIcon>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.