UWP hamburger menu top and bottom - xaml

How can I make Hamburger menu on top and on bottom in XAML - UWP?
This is my SplitView.Pane
<SplitView.Pane>
<Grid>
<Border Background="{StaticResource PanelBackground}"/>
<ListView x:Name="navMenuList"
SelectionMode="Single"
IsItemClickEnabled="True"
Margin="0,0,0,0" ItemsSource="{Binding Menus}">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Width="240" HorizontalAlignment="Left" Height="48">
<SymbolIcon Margin="2,0,0,0" Symbol="{Binding Symbol}" Foreground="White"/>
<TextBlock Margin="24,0,0,0" Text="{Binding Text}" VerticalAlignment="Center" Foreground="White"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="ItemClick">
<core:InvokeCommandAction Command="{Binding Path=MenuCommand}" CommandParameter="{Binding Target}"/>
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
</ListView>
</Grid>
</SplitView.Pane>
Is a good way to duplicite whole ListView with another binding?
// EDIT
I need something like this (but with more menu items :)):

<SplitView x:Name"RootSplitView">
</SplitView>
<ToggleButton x:Name="TogglePaneButton"
TabIndex="1"
Style="{StaticResource SplitViewTogglePaneButtonStyle}"
IsChecked="{Binding IsPaneOpen, ElementName=RootSplitView, Mode=TwoWay}"
Unchecked="TogglePaneButton_Checked"
AutomationProperties.Name="Menu"
ToolTipService.ToolTip="Menu" Background="#E53DAFBD" Foreground="#FFF9EAEA" />
You can try this code

<SplitView.Pane>
<Grid>
<StackPanel>
<ToggleButton x:Name="HamburgerButton" FontFamily="Segoe MDL2 Assets" Content=""
Width="50" Height="50" Background="Transparent" Tapped="HamburgerButton_Tapped" Foreground="White"
FontSize="16" FontWeight="Bold" Style="{StaticResource HamburgerToggleButtonStyle}" />
<RadioButton Content="Top 1" x:Name="btn1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
<RadioButton Content="Top 2" x:Name="btn2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="True" Foreground="White" GroupName="HamMenu"/>
<RadioButton Content="Top 3" x:Name="btn3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
</StackPanel>
<StackPanel VerticalAlignment="Bottom">
<RadioButton Content="Bottom 1" x:Name="btn4" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
<RadioButton Content="Bottom 2" x:Name="btn5" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" IsChecked="False" Foreground="White" GroupName="HamMenu"/>
</StackPanel>
</Grid>
</SplitView.Pane>

Related

Execute command from DataTemplate

I have the following code:
<StackPanel Orientation="Vertical">
<GridView
Background="Azure"
x:Name="ContactList"
ItemsSource="{Binding Path=Users}"
SelectedItem="{Binding SelectedUser, Mode=TwoWay}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:InvokeCommandAction
Command="{Binding MyCommandOnTheViewModel, Mode=OneWay}"/>
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
<GridView.ItemTemplate>
<DataTemplate>
<Border Width="300" Height="Auto" BorderThickness="1">
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left">
<Run FontWeight="Bold" Text="{Binding Name}" />
<Run Text="{Binding Age}" />
</TextBlock>
<StackPanel Orientation="Horizontal">
<Button Content="Button1" HorizontalAlignment="Left"></Button>
<Button Content="Button2" HorizontalAlignment="Right"></Button>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</StackPanel>
At this point, the Command: MyCommandOnTheViewModel gets executed when I click on an item in the list. As you can see I also have a StackPanel containing two buttons. How Can I Bind two separate Commands to each button?
I´ve been trying to give my buttons names thinking that I could somehow do something like:
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged" ELEMENTNAME="MyButtonsName">
<core:InvokeCommandAction
Command="{Binding MyCommandOnTheViewModel, Mode=OneWay}"/>
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
But there does not seem to work like that.
Any tips appreciated!
This is what worked for me:
<Button Content="MyButton"
Command ="{Binding ElementName=ContactList,Path=DataContext.MyCommand}"></Button>
Thanks you for all help #Utsav
You can give Command property to each button. In that way you can easily bind two seperate commands in viewmodel with the two buttons, on click event.
See the code below.
<StackPanel Orientation="Vertical">
<GridView
Background="Azure"
x:Name="ContactList"
ItemsSource="{Binding Path=Users}"
SelectedItem="{Binding SelectedUser, Mode=TwoWay}">
<interactivity:Interaction.Behaviors>
<core:EventTriggerBehavior EventName="SelectionChanged">
<core:InvokeCommandAction
Command="{Binding MyCommandOnTheViewModel, Mode=OneWay}"/>
</core:EventTriggerBehavior>
</interactivity:Interaction.Behaviors>
<GridView.ItemTemplate>
<DataTemplate>
<Border Width="300" Height="Auto" BorderThickness="1">
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left">
<Run FontWeight="Bold" Text="{Binding Name}" />
<Run Text="{Binding Age}" />
</TextBlock>
<StackPanel Orientation="Horizontal">
<Button Content="Button1" HorizontalAlignment="Left" Command="{Binding CommandLeftBtn}"></Button>
<Button Content="Button2" HorizontalAlignment="Right" Command="{Binding CommandRightBtn}"></Button>
</StackPanel>
</StackPanel>
</Border>
</DataTemplate>
</GridView.ItemTemplate>
</GridView>
</StackPanel>

Windows Phone 7 - TextBlock Font style is changing when i give into the button content

I want to add the TextBlock into the Button content. But if i add the TextBlock into the button content the TextBlock font style is changing.
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top">
<TextBlock Text="Vijaya dhas" FontSize="36" FontWeight="Black"/>
<TextBlock Text="Mobile App Developer Trainee" FontSize="26" FontWeight="SemiBold"/>
<TextBlock Text="Chennai" FontSize="24" FontWeight="Medium"/>
</StackPanel>
If i give like this my out put is:
If I give this into the button content:
<Button Height="200">
<Button.Content>
<StackPanel>
<TextBlock Text="Vijaya dhas" FontSize="36" FontWeight="Black"/>
<TextBlock Text="Mobile App Developer Trainee" FontSize="26" FontWeight="SemiBold"/>
<TextBlock Text="Chennai" FontSize="24" FontWeight="Medium"/>
</StackPanel>
</Button.Content>
</Button>
the out put is:
I don't want change the TextBlock font style. Please give any idea to keep the font style what ever it is.
Here i have attached my list box example for your review:
Without Using Button:
Using Button Content:
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--TitlePanel contains the name of the application and page title-->
<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="ApplicationTitle" Text="List Example" Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock x:Name="PageTitle" Text="Example" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="2,0,2,0" Background="#FFE5E5E5">
<TextBlock Text="List Box With Button Content" Margin="0,150,0,0" FontSize="26" Foreground="Red" VerticalAlignment="Top" />
<ListBox HorizontalAlignment="Left" Margin="0,180,0,0" Name="listBox1" VerticalAlignment="Top" Width="480" ItemsSource="{Binding Content, Mode=TwoWay}">
<ListBox.ItemTemplate>
<DataTemplate>
<Button BorderBrush="Transparent" Template="{x:Null}">
<Button.Content>
<Border Margin="0,0,0,0" BorderThickness="1" BorderBrush="Gray" Padding="1" Width="476">
<StackPanel Orientation="Horizontal">
<Border Height="110" Width="110" Margin="5,0,0,0" BorderThickness="1" BorderBrush="Black">
<StackPanel Height="110" Width="110" Background="White">
<Image Source="/NewExample;component/Images/Koala.jpg" Stretch="Fill" Width="100" Height="100" Margin="0,0,0,0"/>
<Image Source="{Binding ImageView}" Stretch="Fill" Width="110" Height="110" Margin="0,-100,0,0"/>
</StackPanel>
</Border>
<TextBlock Text="{Binding TitleView}" Height="30" Width="230" Foreground="Black" Margin="10,0,0,0" TextWrapping="Wrap" FontWeight="Medium" FontSize="24" VerticalAlignment="Top"/>
<TextBlock Text="{Binding Time}" Width="100" Foreground="Black" Margin="30,0,0,0" FontSize="18"/>
<TextBlock Text="{Binding TypeViews}" Width="250" Foreground="Black" Margin="-360,30,0,0" FontSize="18" FontWeight="Medium" HorizontalAlignment="Left" />
<TextBlock Text="{Binding TextContent}" MaxHeight="84" Width="270" TextWrapping="Wrap" Foreground="Black" Margin="-450,50,0,0" FontWeight="Black" FontSize="19" TextTrimming="WordEllipsis" />
<Image Source="{Binding TypeImageView}" Height="35" Width="35" Stretch="Fill" Margin="-120,10,0,0"/>
<Image Width="50" Height="50" Source="{Binding ClickButton}" Stretch="Fill" Margin="-60,10,0,0" Name="balloon_disclosure"/>
<TextBlock Text="{Binding TextView}" Width="250" Foreground="Black" Margin="-360,100,0,0" FontSize="20" FontWeight="Medium" HorizontalAlignment="Left" />
</StackPanel>
</Border>
</Button.Content>
</Button>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
To Get rid of the button's default padding, margin and styles etc, set its template to "{x:Null}"
<Button Height="200" Template="{x:Null}">
<Button.Content>
<StackPanel>
<TextBlock Text="Vijaya dhas" FontSize="36" FontWeight="Black"/>
<TextBlock Text="Mobile App Developer Trainee" FontSize="26" FontWeight="SemiBold"/>
<TextBlock Text="Chennai" FontSize="24" FontWeight="Medium"/>
</StackPanel>
</Button.Content>
</Button>

Windows Store app, Listview Groupheaderplacement Left and vertical scrolling

So I'm having a issue with GroupHeaderPlacement and Vertical scrolling.
What Im trying to achieve is this:
But for some reason my groups are getting arranged in a horisontal scrolling direction. Anyone know if I'm missing something obvious here or if you simple can't have a vertical scrolling Listview if you have GroupHeaderPlacement Left.
The Code is:<ListView x:Name="ItemsGridView"
Margin="118,-5,0,0"
ItemsSource="{Binding Source={StaticResource AllCurrentGroup}}"
SelectionMode="Single"
Grid.Row="2"
Grid.Column="0"
ShowsScrollingPlaceholders="False"
SelectionChanged="SelectedPresentationItem_SelectionChanged"
IsSwipeEnabled="True">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<ItemsWrapGrid GroupHeaderPlacement="Left" Orientation="Vertical" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Grid.Column="1" Height="80" Margin="40,0,0,0" >
<TextBlock Text="{Binding Tid }" Style="{StaticResource BodyTextBlockStyle}" Grid.Column="1" >
<TextBlock.Foreground>
<SolidColorBrush Color="{StaticResource Orange}"/>
</TextBlock.Foreground>
</TextBlock>
<TextBlock Text="{Binding Titel }" Style="{StaticResource SubheaderTextBlockStyle}" Grid.Column="1" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<StackPanel Grid.Column="0" Grid.RowSpan="{Binding Rows}" Width="160" Height="200">
<StackPanel.Background>
<SolidColorBrush Color="{StaticResource BlueDark}"/>
</StackPanel.Background>
<TextBlock Text="{Binding Vecka, Converter={StaticResource ToWeekString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/>
<TextBlock Text="{Binding Datum, Converter={StaticResource ToDayNumber }}" Style="{StaticResource HeaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" Margin="20,26,0,0"/>
<TextBlock Text="{Binding Datum, Converter={StaticResource ToMonth }}" Style="{StaticResource SubheaderTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,-3,0,0"/>
<TextBlock Text="{Binding Datum, Converter={StaticResource ToDayString }}" Style="{StaticResource BodyTextBlockStyle}" Foreground="#FFFFFFFF" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Global User Interface" Margin="20,13,0,0"/>
</StackPanel>
</DataTemplate>
</GroupStyle.HeaderTemplate>
<GroupStyle.Panel>
<ItemsPanelTemplate>
<WrapGrid Orientation="Vertical"></WrapGrid>
</ItemsPanelTemplate>
</GroupStyle.Panel>
</GroupStyle>
</ListView.GroupStyle>
</ListView>
http://code.msdn.microsoft.com/windowsapps/GroupedGridView-77c59e8e/sourcecode?fileId=44751&pathId=298223712
Please refer the above sample link which helps you to achieve your req.

is there any limit for items in a listbox for windows phone 8?

i have a listbox with around 150 items in it. the problem is that it is not taking any events. other listboxes have less than 90 items and they are working fine.
is there any limit or something which is preventing event handeling??
<ScrollViewer HorizontalAlignment="Left" Height="170" Margin="0,421,0,0" VerticalAlignment="Top" Width="480" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled">
<ListBox Name="thirdList" Tap="firstList_SelectionChanged_1" Height="170" ScrollViewer.VerticalScrollBarVisibility="Disabled" >
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragCompleted="GestureListener_DragCompleted"></toolkit:GestureListener>
</toolkit:GestureService.GestureListener>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0 0 0 0 " />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Height="170" Width="150" Background="Transparent">
<!--Replace rectangle with image-->
<Image Source="{Binding image}" Stretch="UniformToFill" Margin="0,20" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="140" Width="119"></Image>
<Grid Margin="0,-335,0,0" HorizontalAlignment="Center" Background="Transparent" Height="30">
<TextBlock TextAlignment="Center" Text="{Binding brandName}" HorizontalAlignment="Center" FontSize="15" TextWrapping="NoWrap" Foreground="#FFAA1F17" />
</Grid>
<StackPanel Width="165" Margin="0,-65,0,0" Background="Transparent">
<Grid HorizontalAlignment="Stretch" Height="55" Background="#FF9B9A9A">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent">
<TextBlock TextAlignment="Center" Text="{Binding productName}" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="White" FontSize="15" />
<TextBlock TextAlignment="Center" Text="{Binding price}" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="#99FFFFFF" FontSize="15" />
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
vjamit please consider using LongListSelector for Windows Phone 8 applications and not the old ListBox.
I have tested LLS with more than 5k items and it loads and plays just fine.
Also there is no need at all to wrap LLS in a ScrollViewer. Check below example:
<phone:PhoneApplicationPage.Resources>
<DataTemplate x:Key="LLSTemplate">
<Grid Tap="firstList_SelectionChanged_1">
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragCompleted="GestureListener_DragCompleted"></toolkit:GestureListener>
</toolkit:GestureService.GestureListener>
<StackPanel Orientation="Vertical" Height="170" Width="150" Background="Transparent">
<!--Replace rectangle with image-->
<Image Source="{Binding image}" Stretch="UniformToFill" Margin="0,20" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="140" Width="119"></Image>
<Grid Margin="0,-335,0,0" HorizontalAlignment="Center" Background="Transparent" Height="30">
<TextBlock TextAlignment="Center" Text="{Binding brandName}" HorizontalAlignment="Center" FontSize="15" TextWrapping="NoWrap" Foreground="#FFAA1F17" />
</Grid>
<StackPanel Width="165" Margin="0,-65,0,0" Background="Transparent">
<Grid HorizontalAlignment="Stretch" Height="55" Background="#FF9B9A9A">
<StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent">
<TextBlock TextAlignment="Center" Text="{Binding productName}" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="White" FontSize="15" />
<TextBlock TextAlignment="Center" Text="{Binding price}" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="#99FFFFFF" FontSize="15" />
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</Grid>
</DataTemplate>
</phone:PhoneApplicationPage.Resources>
<!--ContentPanel - place additional content here-->
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<phone:LongListSelector x:Name="thirdList" Height="170" ItemTemplate="{StaticResource LLSTemplate}"/>
</Grid>
Let me know if the above works.
EDITED:
Try applying the following changes on the ScrollViewer: HorizontalScrollBarVisibility="Disabled". Tested with 500+ and it works. Seems like a "bug".

outofmemory on changing opacity of grid

I have 5 horizontal listboxes with images and text in them.. the text is shown in textblock inside stackpanel(background as grey).. now if i change the background to black and opacity to 0.3, I start getting outofmemory.. what could be wrong?? here's my listbox :
<ScrollViewer x:Name="scroll1" HorizontalAlignment="Left" Height="200" Margin="0,27,0,0" VerticalAlignment="Top" Width="480" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled" >
<ListBox Name="firstList" Height="200" ScrollViewer.VerticalScrollBarVisibility="Disabled" Tap="firstList_SelectionChanged_1" >
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener DragCompleted="GestureListener_DragCompleted"></toolkit:GestureListener>
</toolkit:GestureService.GestureListener>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Padding" Value="0 0 0 0 " />
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical" Height="200" Width="150" Background="Transparent">
<!--Replace rectangle with image-->
<Image Source="{Binding image}" Margin="0,20" HorizontalAlignment="Left" VerticalAlignment="Bottom" Stretch="UniformToFill" Height="140" Width="119"></Image>
<Grid Margin="0,-335,0,0" HorizontalAlignment="Center" Background="Transparent" Height="30">
<TextBlock Text="{Binding brandName}" HorizontalAlignment="Center" FontSize="15" TextWrapping="NoWrap" Foreground="#FFAA1F17" />
</Grid>
<Grid Margin="70,-240,-10,0" Width="50" Height="50" Background="Transparent">
<!--<TextBlock Text="Discount" Foreground="White" FontSize="15" Margin="15,0,5,0"/>-->
<Image Source="{Binding imageSource}" Width="50" Height="50" ></Image>
<TextBlock Text="{Binding discountPercentage}" TextWrapping="NoWrap" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="15" />
</Grid>
<StackPanel Width="150" Margin="0,-35,0,0" Background="Transparent">
<Grid HorizontalAlignment="Stretch" Height="55" Background="#FF9B9A9A">
<!--<TextBlock Text="Rs" Foreground="White" FontSize="20" Margin="30,0,5,0"/>-->
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Transparent">
<TextBlock Text="{Binding productName}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#99FFFFFF" FontSize="15" />
</StackPanel>
</Grid>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</ScrollViewer>
I have tried this and got outofmemoryerror:
<StackPanel Orientation="Vertical" Height="200" Width="150" Background="Transparent">
<!--Replace rectangle with image-->
<Image Source="{Binding image}" Margin="0,20" HorizontalAlignment="Left" VerticalAlignment="Bottom" Stretch="UniformToFill" Height="140" Width="119"></Image>
<Grid Margin="0,-335,0,0" HorizontalAlignment="Center" Background="Transparent" Height="30">
<TextBlock Text="{Binding brandName}" HorizontalAlignment="Center" FontSize="15" TextWrapping="NoWrap" Foreground="#FFAA1F17" />
</Grid>
<Grid Margin="70,-240,-10,0" Width="50" Height="50" Background="Transparent">
<!--<TextBlock Text="Discount" Foreground="White" FontSize="15" Margin="15,0,5,0"/>-->
<Image Source="{Binding imageSource}" Width="50" Height="50" ></Image>
<TextBlock Text="{Binding discountPercentage}" TextWrapping="NoWrap" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White" FontSize="15" />
</Grid>
<StackPanel Width="150" Margin="0,-35,0,0" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" Background="Black" Opacity="0.3">
<TextBlock Text="{Binding productName}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#99FFFFFF" FontSize="15" />
</StackPanel>
</StackPanel>
self resolved. By replacing grid/stackpanel with a textblock on transparent image.