logo
down
shadow

WPF Border shape


WPF Border shape

By : Ivor Filipovic
Date : November 23 2020, 12:01 PM
wish help you to fix your issue I want to create a popup like the one that Lync 2013 has: , This is my XAML:
code :
<Window x:Class="CustomBorderStyle.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        LocationChanged="Window_LocationChanged"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Border BorderBrush="Silver" BorderThickness="1">
            <Button Content="Nice image button" Name="btnThingToClick" Width="100" Height="100" Click="btnThingToClick_Click" />
        </Border>
        <Popup Name="myPopup"
              AllowsTransparency="True"
              PlacementTarget ="{Binding ElementName=btnThingToClick}" 
              Placement="Custom">
            <Grid x:Name="grid" Height="200" Width="200" Background="Transparent">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="40"/>
                </Grid.RowDefinitions>
                <Border BorderBrush="Silver" BorderThickness="1" Background="White" CornerRadius="5" Grid.Row="0" Padding="5">
                    <StackPanel Orientation="Vertical">
                        <TextBlock Text="Some stuff" />
                        <Button Content="Click me" Width="50" />
                    </StackPanel>
                </Border>
                <Path Fill="White" Stretch="Fill" Stroke="Silver" HorizontalAlignment="Left" Margin="30,-1.6,0,0" Width="25" Grid.Row="1" 
                     Data="M22.166642,154.45381 L29.999666,187.66699 40.791059,154.54395"/>
            </Grid>
        </Popup>
    </Grid>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;

namespace CustomBorderStyle
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            //wire up the popup to the popup placement method
            myPopup.CustomPopupPlacementCallback = new CustomPopupPlacementCallback(placePopup);
        }

        private void btnThingToClick_Click(object sender, RoutedEventArgs e)
        {
            //just invert if it's open or not
            myPopup.IsOpen = !myPopup.IsOpen;
        }


        //this is to position the popup next to the button
        public CustomPopupPlacement[] placePopup(Size popupSize,
                                           Size targetSize,
                                           Point offset)
        {
            CustomPopupPlacement placement1 =
               new CustomPopupPlacement(new Point(10, -200), PopupPrimaryAxis.Vertical);

            CustomPopupPlacement placement2 =
                new CustomPopupPlacement(new Point(10, 20), PopupPrimaryAxis.Horizontal);

            CustomPopupPlacement[] ttplaces =
                    new CustomPopupPlacement[] { placement1, placement2 };
            return ttplaces;
        }
        private void Window_LocationChanged(object sender, System.EventArgs e)
        {
            //if the popup is open when the window's location changes
            if (myPopup.IsOpen)
            {
                //toggle the popup to redraw the location
                myPopup.IsOpen = false;
                myPopup.IsOpen = true;
            }
        }
    }
}


Share : facebook icon twitter icon
Border in shape xml

Border in shape xml


By : user3301049
Date : March 29 2020, 07:55 AM
With these it helps I am trying to make a drawable to use for a button. I would like it to have this coloring, with a 2px border around it. , It looks like you forgot the prefix on the color attribute. Try
code :
 <stroke android:width="2dp" android:color="#ff00ffff"/>
Put border on a shape

Put border on a shape


By : diskotechjam
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Without changing the HTML, you could always add the border via an absolutely pseudo element. Just be sure to relatively position the parent element. (example)
code :
.jologo:after {
    content:'';
    position:absolute;
    background:#f15c5c;
    height:40px;
    left:0;
    width:5px;
}
How do I make half a hexagon shape using CSS with a border over a rectangle with a border with an image in the middle of

How do I make half a hexagon shape using CSS with a border over a rectangle with a border with an image in the middle of


By : Shota Ueda
Date : March 29 2020, 07:55 AM
Any of those help How do I make half a hexagon shape with a border and over top a rectangle shape with a border and an image inside the half hexagon shape using CSS and HTML5 , updated with shape and border-colors
code :
div {
  margin-top:1em;;
  text-align: center;
  padding: 0.5em;
  border-top:1px solid lightgray;
  background: linear-gradient(to bottom, #ECECEC 50%, lightgray 50%, lightgray 51%, transparent 52%);
}

img {
  position: relative;
  display: block;
  margin: 10px auto;
  z-index: 1;
}

span {
  text-align: center;
  display: inline-block;
  width:320px;
  position: relative;
  overflow: hidden;
  border-top:1px solid lightgray;
  background: linear-gradient(to left, lightgray, lightgray) bottom center, linear-gradient(40deg, transparent 50px, lightgray, 50px, lightgray 52px, #ECECEC 52px)bottom left, linear-gradient(-40deg,  transparent 50px, lightgray, 50px, lightgray 52px, #ECECEC 52px)bottom right;
  background-repeat: no-repeat;
  background-size: 50% 2px, 50% 100%, 50% 100%;
}
<div>
  <span>
    <img src="http://lorempixel.com/55/46/technics/1" alt="ico"/>
  </span>
</div>
div {
  text-align: center;
  padding: 0.5em;
  background: linear-gradient(to bottom, gray 50%, black 50%);
}
img {
  position: relative;
  display: block;
  padding: 0.5em 0;
  z-index: 1;
}
span {
  text-align: center;
  display: inline-block;
  padding: 0 3em;
  position: relative;
  overflow: hidden;
}
span:before {
  position: absolute;
  content: '';
  bottom: 0;
  left: 50%;
  margin-left: -75px;
  height: 150px;
  width: 150px;
  background: gray;
  transform: rotate(45deg);
}
<div>
  <span>
    <img src="http://lorempixel.com/40/50/nature/3" alt="ico"/>
  </span>
</div>
div {
  text-align: center;
  padding: 0.5em;
  background: linear-gradient(to bottom, gray 50%, black 50%);
}
img {
  position: relative;
  display: block;
  padding: 0.5em 0;
  z-index: 1;
}
span {
  text-align: center;
  display: inline-block;
  padding: 0 3em;
  position: relative;
  overflow: hidden;
  background: linear-gradient(40deg, transparent 1.5em, gray 1.5em)bottom left, linear-gradient(-40deg, transparent 1.5em, gray 1.5em)bottom right;
  background-repeat: no-repeat;
  background-size: 50% 100%;
}
<div>
  <span>
    <img src="http://lorempixel.com/40/50/nature/3" alt="ico"/>
  </span>
</div>
Drawable shape with arrow in the middle of the shape border

Drawable shape with arrow in the middle of the shape border


By : user1735689
Date : March 29 2020, 07:55 AM
To fix this issue , Here is the solution of the image with drawabe
code :
 <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
        <item>
            <shape android:shape="rectangle">
                <solid android:color= "@color/themeColor"></solid>
                <size android:width="150dp" android:height="100dp"/>
            </shape>
        </item>
        <item>
            <rotate android:fromDegrees="45" android:toDegrees="45"
                android:pivotX="12%" android:pivotY="-140%" >
                <shape android:shape="rectangle" >
                    <solid android:color="#ffffff" />
                </shape>
            </rotate>
        </item>
    </layer-list>
How to add different shape border?

How to add different shape border?


By : Lavanya Murthy
Date : March 29 2020, 07:55 AM
hope this fix your issue Is it possible to echieve this kind of thing only using css? , Try this hope it will help:
code :
// DATA -----------

var points = [
  {"x" :  0 , "y" :  40},
  {"x" : 30 , "y" :  40},
  {"x" : 30 , "y" :  20},
  {"x" : 60 , "y" :  20},
  {"x" : 60 , "y" : -10},
  {"x" : 30 , "y" : -10},
  {"x" : 30 , "y" :   0},
  {"x" :  0 , "y" :   0},
  {"x" :  0 , "y" :  10},
  {"x" : -30, "y" :  10},
  {"x" : -30, "y" :  20},
  {"x" :   0, "y" :  20},
];

//-----------

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.translate(c.width / 2, c.height / 2);
ctx.scale(1,-1);

// DRAW THE GRID ----------

ctx.lineWidth = 1;
ctx.strokeStyle= "rgba(0,0,0,0.2)";
ctx.beginPath();

for (let i = 0; i < 200 ;i++) {

  ctx.moveTo(i*10,-200);
  ctx.lineTo(i*10,200);
  
  ctx.moveTo(-i*10,-200);
  ctx.lineTo(-i*10,200);
  
  ctx.moveTo(200, i*10);
  ctx.lineTo(-200, i*10);
  
  ctx.moveTo(200, -i*10);
  ctx.lineTo(-200, -i*10);
  
}

ctx.stroke();
ctx.closePath();

// DRAW THE SHAPE ----------

ctx.beginPath();
ctx.moveTo((points[0].x),(points[0].y));
for (let i = 1; i < points.length ;i++) {
  ctx.lineTo((points[i].x), points[i].y);
}
ctx.closePath();

  
ctx.lineWidth = 2;
ctx.strokeStyle="blue";
ctx.stroke();
ctx.fillStyle="white";
ctx.fill()
.draw {
  border:1px solid grey;
}
<div class="draw"><canvas id="myCanvas" width="200" height="200"></canvas></div>
Related Posts Related Posts :
  • Passing enum type to Converter with integer value
  • Pool of objects with objects that are already on the scene in advance
  • StatusBar text fade-out when binding using Caliburn.Micro
  • Queryfilter on ApplicationUser in OnModelCreating in ApplicationDbContext creates StackOverflowException
  • How to get record form a different table based on a value from first table with linq expression?
  • Show data in Grid from returned model
  • Using Attributes to Override Data Model Conventions
  • Basic OOP console calculator, result Error
  • Compositon and Repository pattern
  • Multiple using statements with if condition
  • How do i increase a number by 1 in every line that contain the number 1
  • Add binding to elements that are created in codebehind
  • How to add a column in an existing AspNetUsers table
  • Order a list of elements with another list of doubles
  • How to setup a NuGet package to copy content files to output build directory?
  • In SignalR Core using ChannelWriter: Do I need to call TryComplete twice if there's an exception?
  • C# GetProcessesByName: issue with colon
  • c# wpf | create complex object with user-defined name to Serialize into JSON
  • How can I get a instance of a generic list with reflection?
  • WPF XAML - Design time and visibility of textbox
  • EF Core and MySql query is too slow
  • Getting Registered App Display Name from an App Id
  • How to get all variables from a string
  • Delete entity with all childs connected
  • Azure Build agent cant´t find class library referance
  • Initialize Nested Dictionaries in c#
  • .Net Core Binding
  • Loading a pop up page in ASP.net through a js file
  • How to pass alert or notification message from controller to View?
  • C# to pause, turn on ssas server, backup cube.... how to?
  • How to execute DataTable.Select() for a column of custom class type for a particular element in that C#
  • how to connect mysql8.0 with C#
  • Passing incorrect values into MultiValueConverter by MultiBinding
  • Can i use IEnumerator as Update func?
  • How to convert API Json response to C# Array?
  • Blazor Textfield Oninput User Typing Delay
  • Performing both layout and render transform results in wrong output
  • uwp beforetextchanged cursor moving in front of text
  • How to keep duplicates from a string[] exclude words from a List and print them out
  • .Net Core Strings.Asc/Mid/Chr/Len missing even after importing Microsoft.VisualBasic
  • How to return to previous search page without being asked to Confirm Form Re-submission and keeping the results on ASP.N
  • How set a identity scaffolding item/page how initial page in asp.net MVC core?
  • LINQ isn't calling Dispose on my IEnumerator when using Union and Select, expected behavior or bug?
  • What is "ByteArray.uncompress()" in AS3 equivalent to in C#?
  • Getting a specific letter from a string variable for my simple guessing game for clues
  • Send an email with Outlook without a subject --- dialog box issue
  • passing List<MyModel> from my controller in the "WebInterfaceProject" to the processor method in "D
  • How to convert Word document created from template by OpenXML into MemoryStream?
  • How can I make a single slider that changes the color of an object?
  • Remap JSON parameter in c#
  • What is the difference between "this ref" and "ref this" when talking about C# 7.2 ref extension met
  • Convert OpenSSL encryption into native C#
  • Accessing Properties in Razor Pages
  • How to get SOAP element value
  • Projection after Group
  • C# error cannot convert sytem.text.regularexpressions.match to string
  • Issues with Save/Load System in a Text Based Adventure game made with ScriptableObjects in Unity
  • VS2019 MSBuild.exe - ASP .Net MVC project fails to publish when using PublishProfile, but works when using OutDir parame
  • Does <pages validateRequest="false" /> in Web.config still matter?
  • How to send new request to redirect URL with new access token
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org