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

Fix ListBox ItemsSource cast error #25

Closed
wants to merge 1 commit into from
Closed

Conversation

hxbb00
Copy link

@hxbb00 hxbb00 commented Nov 8, 2023

image

pseudo-code

<ListBox ItemsSource="{Binding Items}" Grid.Row="1" Name="DrawerPlugList">
  <ListBox.Styles>
	  <Style Selector="ListBoxItem">
		  <Setter Property="Height" Value="48" />
		  <Setter Property="Padding" Value="16,0" />
		  <Setter Property="VerticalContentAlignment" Value="Center" />
		  <Setter Property="IsEnabled" Value="{Binding $self.IsEnabled}" />
	  </Style>
  </ListBox.Styles>
  <ListBox.ItemTemplate>
	  <DataTemplate>
		  <StackPanel Orientation="Horizontal">
			  <icons:MaterialIcon Kind="HomeOutline" Width="24" Height="24" VerticalAlignment="Center" Foreground="Gray" />
			  <TextBlock Text="{Binding Title}"  VerticalAlignment="Center" Margin="8,0,0,0" />
		  </StackPanel>
	  </DataTemplate>
    </ListBox.ItemTemplate>
  </ListBox>

							<ListBox ItemsSource="{Binding PlugItems}"
								 Grid.Row="1" Name="DrawerPlugList">
								<ListBox.Styles>
									<Style Selector="ListBoxItem">
										<Setter Property="Height" Value="48" />
										<Setter Property="Padding" Value="16,0" />
										<Setter Property="VerticalContentAlignment" Value="Center" />
										<Setter Property="IsEnabled" Value="{Binding $self.IsEnabled}" />
									</Style>
								</ListBox.Styles>
								<ListBox.ItemTemplate>
									<DataTemplate>
										<StackPanel Orientation="Horizontal">
											<icons:MaterialIcon Kind="HomeOutline" Width="24" Height="24" VerticalAlignment="Center" Foreground="Gray" />
											<TextBlock Text="{Binding Title}"  VerticalAlignment="Center" Margin="8,0,0,0" />
										</StackPanel>
									</DataTemplate>
								</ListBox.ItemTemplate>
							</ListBox>
@flarive
Copy link
Owner

flarive commented Jan 7, 2024

Hello @hxbb00,

Problem was solved by my previous submit on master i think.
Your sample works well now without any exception.

Fixing this issue
#30
also fix your issue i think

Can you get latest from master and confirm please ?
Sorry for the delay

Eviral
hxbb00

@flarive flarive closed this Jan 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants