Hi all,
I have a WrapPanel control that's within a template that's within a custom control, I need to change it's orientation depending on a certain criteria being met.
<pan:Panorama x:Name="panMainContent" Grid.Column="0" Grid.Row="1" Margin="0,3"
Foreground="Black" UseSnapBackScrolling="False"
VerticalAlignment="Top" IsManipulationEnabled="False"
ScrollViewer.PanningMode="HorizontalOnly"
Friction="0.10000000000000002">
<ListBox x:Name="lbCategories" BorderBrush="{x:Null}"
ScrollViewer.VerticalScrollBarVisibility="Disabled"
ScrollViewer.PanningMode="HorizontalOnly"
removed="{x:Null}" IsManipulationEnabled="True"
ManipulationStarting="lbCategories_ManipulationStarting"
ManipulationCompleted="lbCategories_ManipulationCompleted"
ManipulationStarted="lbCategories_ManipulationStarted"
ItemContainerStyle="{StaticResourceListBoxtemStyleNoHighlighting}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Name="wp" IsItemsHost="True"
Width="Auto" Orientation="Vertical"
Height="{Binding ElementName=gridContent,Path=ActualHeight}"
MaxHeight="500"
ScrollViewer.PanningMode="HorizontalOnly"
IsManipulationEnabled="True" ItemHeight="{Binding ElementName=tt, Path=ActualHeight}" >
</WrapPanel>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<uc:TouchTile x:Name="tt" Click="Tile_Click"
PreviewMouseLeftButtonDown="TouchTile_PreviewMouseLeftButtonDown"
PreviewMouseLeftButtonUp="TouchTile_PreviewMouseLeftButtonUp"
ProcessLaunchCompletedEvent="tt_ProcessLaunchCompletedEvent"
ProcessLaunchStartedEvent="tt_ProcessLaunchStartedEvent" Width="180">
</uc:TouchTile>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</pan:Panorama>
I am having trouble referencing the "wp" WrapPanel from the code behind, as it doesn't appear.
I'm assuming once I have the reference to this control I can literally just:
if (criteria is met)
{
}
else
{
}
Has anyone got any idea how I can refer to this control in the code? Many Thanks!