Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XamlUICommand Icon Missing WinUI 3 #4074

Closed
michael-hawker opened this issue Feb 1, 2021 · 1 comment
Closed

XamlUICommand Icon Missing WinUI 3 #4074

michael-hawker opened this issue Feb 1, 2021 · 1 comment
Labels
area-Commanding AppBar, UICommand, MVVM, etc area-Icon no-issue-activity product-winui3 WinUI 3 issues team-Controls Issue for the Controls team

Comments

@michael-hawker
Copy link
Collaborator

I noticed that when I'm binding to a XamlUICommand, the icon doesn't show up. I don't know if I'm doing something wrong (the last time I programmed with XAML was 15 years ago, in Silverlight at the time, and WinUI is totally new for me atm).

I'm using version 3.0.0-preview3.201113.0

The ViewModel:

private void BindCommands()
{
    this.PickMovieFolder = new XamlUICommand
    {
        IconSource = new SymbolIconSource
        {
            Symbol = Symbol.Folder,
            Foreground = new SolidColorBrush(Color.FromArgb(1, 122, 16, 28))
        },
        Description = "Select a movie folder to add...",
    };
    this.PickMovieFolder.ExecuteRequested += (command, args) =>
    {
        command.DispatcherQueue.TryEnqueue(async () =>
        {
            var folderPicker = new FolderPicker
            {
                SuggestedStartLocation = PickerLocationId.VideosLibrary
            };

            folderPicker.FileTypeFilter.Add("*");

            folderPicker.As<IInitializeWithWindow>().Initialize(Process.GetCurrentProcess().MainWindowHandle);

            var folder = await folderPicker.PickSingleFolderAsync();

            if (folder != null)
            {
                // Do sthg
            }
        });
    };
}

The View:

<Grid Margin="0,12,0,0">
   <Grid.ColumnDefinitions>
       <ColumnDefinition Width="768px" />
       <ColumnDefinition Width="Auto" />
       <ColumnDefinition Width="Auto" />
       <ColumnDefinition Width="Auto" />
   </Grid.ColumnDefinitions>
   <TextBox Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" PlaceholderText="Path to your movie folder (eg: C:\Users\Zeus\Movies)"></TextBox>
   <Button Grid.Row="0" Grid.Column="1" Width="36" Height="32" Margin="-36,0,48,0" BorderThickness="0" CornerRadius="0,1, 1, 0" Command="{Binding Path=PickMovieFolder }" />
   <CheckBox Grid.Row="0" Grid.Column="2" Margin="0,0,12,0" VerticalAlignment="Center">Include subfolders</CheckBox>
   <Button Grid.Row="0" Grid.Column="3" VerticalAlignment="Center">Add folder</Button>
</Grid>

I tried removing the negative margin, but to no effect. When I set the property Label on the XamlUICommand , this shows correctly, only still no icon.

image

I don't know if I'm at the right place here.

Originally posted by @brechtb86 in #1494 (comment)

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Feb 1, 2021
@StephenLPeters StephenLPeters added area-Commanding AppBar, UICommand, MVVM, etc area-Icon team-Controls Issue for the Controls team product-winui3 WinUI 3 issues and removed needs-triage Issue needs to be triaged by the area owners labels Feb 2, 2021
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Commanding AppBar, UICommand, MVVM, etc area-Icon no-issue-activity product-winui3 WinUI 3 issues team-Controls Issue for the Controls team
Projects
None yet
Development

No branches or pull requests

2 participants