i just want to make with WPF using the XAML such a shape :
the shape is in red, kind of box with rectangle like quotation.
can you help ?
thanks alot.
Here's an attempt at something similar to your diagram. Is it of help to you?
<Grid Width="602">
<Path Stroke="Black" StrokeThickness="2" Fill="#FFFFCC" Data="M 0,50 400,50 450,0 500,50 600,50 600,150 0,150 0,50" />
<Grid Margin="0,50,0,0">
<TextBlock Text="Blah blah blah - blah blah?" TextWrapping="Wrap" FontSize="16" FontWeight="Bold" Margin="10" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="10">
<Button Width="100" Content="Yes" />
<Button Width="100" Content="No" Margin="50,0,0,0" />
</StackPanel>
</Grid>
</Grid>
Related
I use LibVLCSharp.WPF in a WPF application.
I want to put some icons and buttons above the video.
But after the VideoView control has loaded, it overwrite everything.
<Canvas Width="325" Height="182">
<Image Source="/Resource/BgLoading_1.png"
Width="325"
Height="182"
Stretch="Fill"
StretchDirection="Both"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Panel.ZIndex="0"
Visibility="Visible" />
<fa:ImageAwesome Foreground="White"
Icon="Spinner"
Spin="True"
Height="48"
Width="48"
Visibility="{Binding LoadImageStatus}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Canvas.Left="139"
Canvas.Top="67" />
<Image x:Name="imgLeftIcon"
Width="30"
Height="30"
Source="{Binding LeftIconSource}"
Stretch="Fill"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="10,10,10,10"
Visibility="{Binding LeftIconStatus}"
Panel.ZIndex="2" />
<Image x:Name="imgRightIcon"
Width="30"
Height="30"
Source="{Binding RightIconSource}"
Stretch="Fill"
Margin="285,10,10,142"
Visibility="{Binding RightIconStatus}"
Panel.ZIndex="2" />
<!--Video-->
<vlc:VideoView Grid.Row="0"
Height="182"
Width="325"
Visibility="{Binding VideoPlayerStatus}"
Panel.ZIndex="1" />
</Canvas>
RTFM
The controls that must appear on top of the video should be placed as children of the VideoView element.
<Window ...
xmlns:vlc="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
...>
<Grid>
<vlc:VideoView x:Name="VideoView">
<Button x:Name="PlayButton"
Click="PlayButtonOnClick"
Content="Play"
Margin="8"
HorizontalAlignment="Right"
VerticalAlignment="Bottom" />
</vlc:VideoView>
</Grid>
</Window>
Avoid Canvas since they are pretty dumb.
Working example sources based on the manual.
I haven't used vlc, if it covers the icons, I think it should be a window drawn with a separate handle. just like WindowsFormHost. try use Popup control, it can be displayed on top of any control.
<Grid>
<!--video control-->
<Grid Name="video">
<!--Video-->
<vlc:VideoView Grid.Row="0"
Height="182"
Width="325"
Visibility="{Binding VideoPlayerStatus}"
Panel.ZIndex="1" />
</Grid>
<Popup PlacementTarget="{Binding ElementName=video}" Placement="Center">
<Grid>
<Image x:Name="imgLeftIcon"
Width="30"
Height="30"
Source="{Binding LeftIconSource}"
Stretch="Fill"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="10,10,10,10"
Visibility="{Binding LeftIconStatus}"
Panel.ZIndex="2" />
</Grid>
</Popup>
</Grid>
How to customize tooltip window to have a corner arrow like shown below in WPF(xaml).
I have my code like below
<Image x:Name="imgInfoTab">
<Image.ToolTip>
<ToolTip Background="WhiteSmoke" HasDropShadow="True"
Cursor="Hand">
<TextBlock Width="250" Height="250"
TextWrapping="WrapWithOverflow"
Cursor="Hand">
</TextBlock>
</ToolTip>
</Image.ToolTip>
</Image>
It looks as below with above code,
Try this:
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="CornflowerBlue">
<Grid.ToolTip>
<ToolTip Placement="MousePoint" HorizontalOffset="50">
<ToolTip.Template>
<ControlTemplate TargetType="ToolTip">
<Grid>
<Path Fill="White" Data="M 0,10 L 40,10 50,0 60,10 100,10 100,60 0,60" />
<TextBlock Text="Hello World!" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
</ToolTip.Template>
</ToolTip>
</Grid.ToolTip>
</Grid>
If you want it auto-sizing then you'll need to do a bit more work, but that will get you started.
In this code I added an image before the button text I'd like to have a space between the image and text but the code I have isn't working.
<Button Height="25"
Width="80"
Margin="5,10,5,10"
Command="{Binding PreviewTemplateCommand}">
<StackPanel Orientation="Horizontal" Height="15" Width="63">
<Image Source="/UILibrary;component/Themes/Default/Images/preview.PNG"
Height="15" Width="15" Margin="0,0,0,0" />
<TextBlock >Preview</TextBlock>
</StackPanel>
</Button>
Hi you have to set the left margin of the textblock. Try this:
<StackPanel Orientation="Horizontal" Height="15" Width="63">
<Image Source="..." Height="15" Width="15" Margin="0,0,0,0" />
<TextBlock Margin="25,0,0,0">Preview</TextBlock>
</StackPanel>
I am using C# and WPF for my GUI. My goal is to display a progress bar under the wpf popup control.
I am using below code add a progress bar under the popup control.
<Popup HorizontalAlignment="Left" Margin="338,261,0,0" Name="popup1" VerticalAlignment="Top" Height="38" Width="153" >
<StackPanel Background="Red">
<ProgressBar Height="15" HorizontalAlignment="Left" Margin="349,272,0,0" Name="progressBar1" VerticalAlignment="Top" Width="130" Foreground="#FF3EA3EA" Value="{Binding ElementName=textBox1, Path=Text.Length, Mode=OneTime}" Maximum="140" />
</StackPanel>
</Popup>
Please Help me.
Thanx in advanced!
You should use below code for showing ProgressBar under the Popup control:
<Popup Name="popup1" HorizontalAlignment="Left" Margin="338,261,0,0" AllowsTransparency="True" VerticalAlignment="Top" Height="38" Width="153">
<Grid>
<ProgressBar HorizontalAlignment="Left"
Name="progressBar1" Height="25"
VerticalAlignment="Center" Width="130"
Foreground="#FF3EA3EA"
Value="{Binding ElementName=textBox1, Path=Text.Length, Mode=OneTime}"
Maximum="140" ForceCursor="False" />
</Grid>
</Popup>
I'm having some trouble displaying a rotated progress bar. Ideally I would like to have no gap between the progress bar and textblock. Any suggestions?
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<ProgressBar Height="20" Width="430">
<ProgressBar.RenderTransform>
<RotateTransform Angle="-90" />
</ProgressBar.RenderTransform>
</ProgressBar>
<TextBlock Width="100" Height="500" Text="test" />
</StackPanel>
Try LayoutTransofrm instead of RenderTransform:
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<ProgressBar Height="20" Width="430">
<ProgressBar.LayoutTransform>
<RotateTransform Angle="-90" />
</ProgressBar.LayoutTransform>
</ProgressBar>
<TextBlock Width="100" Height="500" Text="test" />
</StackPanel>