Adding Contacts.contactdown to TagVisualization - pixelsense

I am working with TagVisualization, which displays an ellipse around the tag with name. I want to put 2 round buttons on the circumference (at well defined points) on the ellipse so that clicking them will result in change of some label text. I am unable to do this because I am unable to add s:Contacts.ContactDown property to the smaller ellipse.
Below is the XAML:
<s:TagVisualization x:Class="ControlsBox.TagVisual"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Loaded="TagVisual_Loaded">
<Canvas>
<Ellipse Width="300" Height="300" Stroke="White" StrokeThickness="8" Opacity="0.7">
<Ellipse.Effect>
<BlurEffect Radius="12" />
</Ellipse.Effect>
</Ellipse>
<Ellipse Height="296" Width="296" Stroke="AntiqueWhite" StrokeThickness="4" >
<Ellipse.Effect>
<BlurEffect Radius="4"/>
</Ellipse.Effect>
</Ellipse>
<Label Content="John's Phone" HorizontalContentAlignment="Center" Padding="0,250,0,0" VerticalContentAlignment="Bottom" IsHitTestVisible="false">
<Label.Effect>
<DropShadowEffect BlurRadius="9" ShadowDepth="0" Color="Aqua"/>
</Label.Effect>
</Label>
<Ellipse Height="40" Width="40" Stroke="White" StrokeThickness="4" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,70,0,0" Fill="Black"
s:Contacts.ContactDown="UNABLE_TO_ADD" />
</Canvas>

After doing bit of googling, it appeared that using Expression Blend to create buttons with a style is an easier option.

Related

Fix position of Label

I have two buttons on either side of a Label.
If either of these Buttons get removed, I want the Label to stay centered in a fixed position.
Is there any way to lock the position of this Label?
<DockPanel LastChildFill="True">
<DockPanel DockPanel.Dock="Top" Margin="4,8,4,8" LastChildFill="True">
<Button Name="SearchBackButton" Style="{DynamicResourceInfoButtonStyle}" Content="{StaticResource SearchBackButton}"
VerticalAlignment="Center" HorizontalAlignment="Left" Margin="4,0,0,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Left" Click="SearchBackButton_Click" />
<Label HorizontalAlignment="Center" FontFamily="HelveticaNeue" FontSize="14" FontStyle="Normal" FontWeight="SemiBold" Foreground="#273238" Name="SuggestedTemplatesText" Content="{x:Static res:UIStrings.SuggestedTemplates}"/>
<Button Name="info_icon" Style="{DynamicResource InfoButtonStyle}" Click="InfoButton_Click"
VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,4,0" BorderBrush="Transparent" Background="Transparent" DockPanel.Dock="Right"/>
</DockPanel>
</DockPanel> <!-- Added by edit -->
This is the code for the Label and the two Buttons.

WPF- Auto Resize the popup control

I am New WPF. I have PopupControl below is XAML for that:-
<Popup Name="PopupRemark" AllowsTransparency="True" Placement="Left" HorizontalOffset="45" VerticalOffset="-22"
PlacementTarget="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=ToggleButton}}"
IsOpen="{Binding IsChecked, ElementName=btnInfo}" StaysOpen="False" >
<Canvas Width="230" Height="200" Background="Transparent" >
<Path x:Name="Container" Canvas.Left="0" Canvas.Top="0" Fill="#f2f6f7" Stroke="#A9A9A9"
Data="M 230,40 L220,50 220,90 0,90 0,0 220,0 220,30 230,40">
<Path.Effect>
<DropShadowEffect BlurRadius="18" Color="Black" Opacity="0.4"/>
</Path.Effect>
</Path>
<Label Grid.Row="0" FontSize="13" FontWeight="Bold" FontFamily="Roboto" Content="Remark" HorizontalAlignment="Left" Margin="0" VerticalAlignment="Center"/>
<TextBlock Canvas.Left="5" Canvas.Top="25" Width="210" Text="{Binding Remark}" Foreground="#2c3e50" FontFamily="Roboto" FontSize="11" TextWrapping="Wrapwithoverflow" />
</Canvas>
</Popup>
Issue is, I want to set auto height & width for canvas or popup control so my popup will size as per content into it.I googled and knew that canvas should have fix height or width but is there any solution(Workaround) to make popup auto sizable.or how can add scroller into popup. It will be greatly appreciable
Thanks in advance

Shadow effect to Image/StackPanel in Windows Universal App

How can I add shadow effect in Windows universal app?
I have added Image into StackPanel. I want to add shadow effect to that control (StackPanel).
I am trying to do something like below image.
This should give you the inspiration to arrive at something you like.
<StackPanel Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid Width="100" Height="100" Margin="0,10">
<Image Source="PinkSquare.png" Width="95" Height="95" HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0.5"/>
<Image Source="PinkSquare.png" Width="95" Height="95" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
<Grid Width="100" Height="100" Margin="0,10">
<Image Source="GraySquare.png" Width="95" Height="95" HorizontalAlignment="Right" VerticalAlignment="Bottom" Opacity="0.5"/>
<Image Source="PinkSquare.png" Width="95" Height="95" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</Grid>
</StackPanel>
Add borders, rounded corners, gradients, etc. to achieve the final look you like.

How to create scrollable canvas in WinRT?

I tried this, but I can't scroll the canvas. I tried to handle mousewheel change event of other controls but scrolling is not working. Anybody has idea what I am doing wrong ?
<Viewbox Stretch="Fill" StretchDirection="Both" Height="300" Width="300">
<ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollMode="Enabled"
ScrollViewer.VerticalScrollBarVisibility="Disabled" Margin="20,0,20,0" Height="300" Width="300">
<Canvas Background="White" Height="300" Width="500">
<TextBlock FontSize="20" Text="This Is Far Right" Canvas.Left="350" Foreground="Black" />
</Canvas>
</ScrollViewer>
</Viewbox>
Try specify width and height of the canvas bigger than the outer element, eg.
<Canvas Background="White" Width="500" Height="500" />
ScrollViewer.VerticalScrollMode="Disabled" solved my problem.

How to user surfaceslider with touch control

I want to use my surfaceslider control inside tagvisualization so that it responds to finger touch when an object is placed, but when I run the program it doesnt moves at all. Can anybody give me pointers (I am new to this sdk).
<s:TagVisualization x:Class="ControlsBox.TagVisual"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:s="http://schemas.microsoft.com/surface/2008"
Loaded="TagVisual_Loaded">
<Grid>
<!--ProgressBar Margin="50" HorizontalAlignment="Center" Value=""-->
<TextBlock Height="23" HorizontalAlignment="Center" Margin="0" Name="textBlock1" Text="" VerticalAlignment="Top" Padding="0,6,0,0" Foreground="#FFAA4A4A" />
<s:SurfaceSlider Width="100" Height="20" HorizontalAlignment="Center" VerticalAlignment="Top" Padding="0,50,0,0" Value="60" IsSelectionRangeEnabled="False" Margin="20" Name="mySlider" Maximum="100" Interval="1" ValueChanged="mySlider_ValueChanged">
<s:SurfaceSlider.Effect>
<BlurEffect Radius="2"/>
</s:SurfaceSlider.Effect>
</s:SurfaceSlider>
<Ellipse Width="200" Height="200" Stroke="White" StrokeThickness="8" Opacity="0.7">
<Ellipse.Effect>
<BlurEffect Radius="12" />
</Ellipse.Effect>
</Ellipse>
<Ellipse Height="196" Width="196" Stroke="AntiqueWhite" StrokeThickness="4" >
<Ellipse.Effect>
<BlurEffect Radius="4"/>
</Ellipse.Effect>
</Ellipse>
<Label Content="John's Phone" HorizontalContentAlignment="Center" Padding="0,150,0,0" VerticalContentAlignment="Bottom">
<Label.Effect>
<DropShadowEffect BlurRadius="9" ShadowDepth="0" Color="Aqua"/>
</Label.Effect>
</Label>
</Grid>
private void mySlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
this.textBlock1.Text = Math.Round(this.mySlider.Value/100,2).ToString();
}
The label is covering it up so the touch doesn't get to it. Set IsHitTestVisible=false on the label and anything else you don't want to receive touch input. Mouse input works the same way. Tools like "Snoop" are great for debugging issues like this