I have a Popup which contains an ItemsControl (I can use ListBox if needed) which its items are arranged horizontally.
Since the total width of the items can exceed the width of the screen, I need to limit the size of the popup width.
My question is how can I limit the size of the popup? I've tried to use MaxWidth, but it doesn't work :(
<Popup x:Name="puSoldItems" IsOpen="False" IsLightDismissEnabled="True" MaxWidth="{Binding ActualWidth, ElementName=_This}" ScrollViewer.HorizontalScrollMode="Auto" ScrollViewer.VerticalScrollMode="Auto">
<Grid Background="#f8202020" MaxWidth="{Binding ActualWidth, ElementName=puSoldItems}">
...
...
...
<ItemsControl x:Name="icItems" Grid.Row="1" Background="Transparent" Margin="10" MaxWidth="{Binding ActualWidth, ElementName=puSoldItems}" ScrollViewer.HorizontalScrollMode="Auto" ScrollViewer.VerticalScrollMode="Auto">
...
...
...
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Padding="0" Margin="0 0 0 10" BorderBrush="#afafaf" BorderThickness="0 0 0 1" MinWidth="350">
...
...
...
<local:UPSoldItemList ItemsSource="{Binding Items}"></local:UPMenuModifier>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</Popup>
Thanks...