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

Net Maui on platform Windows PointerOver and Selected states is not working together ? #19708

Closed
ssamix opened this issue Jan 5, 2024 · 5 comments
Labels
platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working

Comments

@ssamix
Copy link

ssamix commented Jan 5, 2024

Description

Net Maui on platform Windows PointerOver and Selected states is not working together ? Also when I set first selection is selected (
MyCollectionview.SelectedItem = ((ObservableCollection)MyCollectionview.ItemsSource).FirstOrDefault(); )
selection is done but color of item disappear
I think It is bug. .How to fix it ? Thanks

Steps to Reproduce

No response

Link to public reproduction project repository

No response

Version with bug

8.0.3

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

8.0.3

Affected platforms

Windows

Affected platform versions

No response

Did you find any workaround?

No response

Relevant log output

No response

@ssamix ssamix added the t/bug Something isn't working label Jan 5, 2024
@drasticactions
Copy link
Contributor

Could you please create a reproduceable sample showing what you wrote and how you implemented it? I'm not sure what you're trying to do based on what you wrote.

@drasticactions drasticactions added the s/needs-repro Attach a solution or code which reproduces the issue label Jan 5, 2024
@ghost
Copy link

ghost commented Jan 5, 2024

Hi @ssamix. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@ssamix
Copy link
Author

ssamix commented Jan 5, 2024

xml....



<CollectionView.ItemsLayout>

</CollectionView.ItemsLayout>
<CollectionView.ItemTemplate>





</CollectionView.ItemTemplate>

class.....

public partial class TabsFixed : ContentView
{
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create("ItemsSource", typeof(ObservableCollection), typeof(TabsFixed), new ObservableCollection());
public ObservableCollection ItemsSource
{
get { return (ObservableCollection)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
}

public TabsFixed()
{
    InitializeComponent();
    Content.BindingContext = this;

    Setter backgroundColorSetter = new Setter() { Property = Grid.BackgroundColorProperty, Value = new Binding("MyColor") };
    Setter textColorSetter = new Setter() { Property = Label.TextColorProperty, Value = Colors.White, TargetName = "tabLabel" };
    VisualState stateNormal = new VisualState() { Name = CommonStates.Normal };
    VisualState statePointOver = new VisualState() { Name = CommonStates.PointerOver, Setters = { backgroundColorSetter, textColorSetter } };
    VisualState stateSelected = new VisualState() { Name = CommonStates.Selected, Setters = { backgroundColorSetter, textColorSetter } };

    VisualStateGroup visualStateGroup = new VisualStateGroup() { Name = nameof(CommonStates), States = { stateNormal,stateSelected,statePointOver } };
    VisualStateGroupList visualStateGroupList = new VisualStateGroupList() { visualStateGroup };
    Setter vsgSetter = new Setter() { Property = VisualStateManager.VisualStateGroupsProperty, Value = visualStateGroupList };
    Style style = new Style(typeof(Grid)) { Setters = { vsgSetter } };
    Resources.Add(style);

Loaded += TabsFixed_Loaded;

}

private void TabsFixed_Loaded(object? sender, EventArgs e)
{
    TabsF.SelectedItem = ((ObservableCollection<TabsItem>)TabsF.ItemsSource).FirstOrDefault();

}

}

contentPage.....

<Grid >

<control:TabsFixed ItemsSource="{Binding MainMenu}" HorizontalOptions="FillAndExpand" />

</Grid>

class...

public partial class Mainpage: ContenPage
{
public Mainpage()
{
InitializeComponent();
BindingContext= new MenuViewModel();
}
}

menuviewmodel ....

public class MenuViewModel:ViewModelBase
{

  public ObservableCollection<TabsItem> _MainMenu = new ObservableCollection<TabsItem>();
  public ObservableCollection<TabsItem> MainMenu
  {
      get
      {
          return _MainMenu ;
      }
      set
      {
          _MainMenu = value;
          OnPropertyChanged("MainMenu ");
      }
  }

  public MenuViewModel()
  {
      PopulateData();
  }

  void PopulateData()
  {
      MainMenu .Clear();
      MainMenu .Add(new TabsItem() { TabTitle = "Shopping", BColor = "#339933" });
      MainMenu .Add(new TabsItem() { TabTitle = "Food", BColor = "#FF0000" });
  }

}

@ghost ghost added s/needs-attention Issue has more information and needs another look and removed s/needs-repro Attach a solution or code which reproduces the issue labels Jan 5, 2024
@jsuarezruiz jsuarezruiz added platform/windows 🪟 s/needs-repro Attach a solution or code which reproduces the issue labels Jan 8, 2024
@ghost
Copy link

ghost commented Jan 8, 2024

Hi @ssamix. We have added the "s/needs-repro" label to this issue, which indicates that we require steps and sample code to reproduce the issue before we can take further action. Please try to create a minimal sample project/solution or code samples which reproduce the issue, ideally as a GitHub repo that we can clone. See more details about creating repros here: https://github.com/dotnet/maui/blob/main/.github/repro.md

This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@samhouts samhouts added the potential-regression This issue described a possible regression on a currently supported version., verification pending label Jan 9, 2024
@ghost ghost added the s/no-recent-activity Issue has had no recent activity label Jan 15, 2024
@ghost
Copy link

ghost commented Jan 15, 2024

This issue has been automatically marked as stale because it has been marked as requiring author feedback to reproduce the issue but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

@ghost ghost closed this as completed Jan 18, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 17, 2024
@ghost ghost removed the s/no-recent-activity Issue has had no recent activity label Feb 17, 2024
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform/windows 🪟 potential-regression This issue described a possible regression on a currently supported version., verification pending s/needs-attention Issue has more information and needs another look s/needs-repro Attach a solution or code which reproduces the issue t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants