I need to create a rectangle that has a cloud-like border. Do I need to create a custom Stroke or should I be looking at creating something else?
I don't think any border properties can provide you with a more advanced shape than rounded edges by using CornerRadius. By defining a GradientBrush inside Border.BorderBrush you could get some advanced coloring, but i think you should look at drawing a path if you want the border to look like a cloud. I found this code for a custom shape here. I'm no expert at the path data, so I can't help you draw the shape but pretty sure you will be able to create a cloud.
<Path Data="M125.11371,0.5 L141.0695,20.500002 L249.5,20.500002 L249.5,
119.5 L0.5,119.5 L0.5,20.500002 L108.9748,20.500002 z"
Fill="#FF2D2D2D" Stretch="Fill" Stroke="#FF2D2D2D"
UseLayoutRounding="False" Width="250" Height="100"/>
Related
I can't center the shadow provided by <toolkit:ElevatedView> around the contained object. By default the shadow falls to the lower right corner. I've tried shifting with margins as well as RenderTransform, but can't find a good way to move the shadow.
What I have:
<toolkit:ElevatedView x:Name="Shadow1" Elevation="25" ShadowColor="Gray" CornerRadius="20" Background="Transparent">
<Grid>
<Grid.RenderTransform>
<TranslateTransform X="20" Y="20"/>
</Grid.RenderTransform>
...stuff
</Grid>
</toolkit:ElevatedView>
This kind of works but screws up the grid corner radius because it is being shifted beyond its max width. Is there a way to simply move the shadow location instead of trying to shift the content inside the shadow?
As of Uno Platform 3.11, the ElevatedView Control does not support changing the orientation of the shadow, only the elevation.
You may want to open an enhancement request on the Uno Platform GitHub repository.
Either I'm going crazy or borders with a corner radius do not render correctly in UWP. Take this extremely simple example:
<Border CornerRadius="6" BorderBrush="Blue" BorderThickness="1">
<Rectangle Fill="Black" />
</Border>
And see how the rectangle extends slightly beyond border:
This happens in the designer in the visual studio and when the app is running.
It only seems to happen when there is a borderthickness >0 on the border.
Any idea why this happens?
If you are looking to apply corner radius to rectangle. Its better to use RadiusX and RadiusY properties of rectangle. Using like this will not cause any issues in rendering.
<Rectangle Width="100" RadiusX="10" RadiusY="10" Height="60" Stroke="Red" StrokeThickness="2" Fill="Black" > </Rectangle>
I managed to find a rather annoying solution by just using two borders. One with the correct border radius and style, and a second border within in for fine tuning the corners that kept clipping through.
I noticed the issues were mostly in the upper left and right corners and it was fixed by altering the corner radius of the inner border and padding of the outer border.
Source: https://stackoverflow.com/a/61468325
In windows phone 8 I want to put an Image in a circle. Is there a container like grid which have a circular form? I know that there is ellipse bit it is not a container
Here is how I do it.
<Ellipse Width="100"
Height="100">
<Ellipse.Fill>
<ImageBrush>
<ImageBrush.ImageSource>
<BitmapImage UriSource="/YourImage.png" />
</ImageBrush.ImageSource>
</ImageBrush>
</Ellipse.Fill>
</Ellipse>
As a best practice, consider setting DecodePixelWidth and DecodePixelHeight to the same size as your ellipse.
Another option to mleroy's answer (since if I remember right WP is based on silverlight and I often run into a lack of brush availability to do stuff like that.) You could do this using the Clip property.
For example;
<Image
Source="blah\yourpicture.jpg"
Width="100" Height="100">
<Image.Clip>
<EllipseGeometry
RadiusX="100"
RadiusY="100"
Center="100,100"/>
</Image.Clip>
</Image>
Hope this helps, cheers
Edit Addition: You could also bind your radius X/Y to the width/height of the image for more flexibility on dynamic sized images.
I see that most of the WPF stuff use for example DropShadowEffect, but my xaml in WinRT doesn't recognize that, is there something else to use?
However it's easy to add dropshadow to text. As photoshop dude I immediately released this:
<Grid>
<TextBlock Margin="1,1,0,0" Foreground="<!--Shadow Color-->" Text="Some text"/>
<TextBlock Foreground="<!--Text Color-->" Text="Some text"/>
</Grid>
You are correct, the DropShadowEffect is not available in Windows Store apps.
For now, effects are programmed with DirectX and C++. If you don't want to write your own interop library in C++, check out the sharpdx.org/ library
If you know the Shape of the Control you could create an Image (.png e.g.) with a dropshadow effect towards the outer bounds and include it in the style of the control with the help of Nine-Grid ( http://msdn.microsoft.com/en-us/library/windows/desktop/bb189722.aspx )
(if the dropshadow is 5px wide you can set the margin to -5 and the nine-grid values to 5 to make the shadow appear around the control)
Greetings
You can use DropShadowBitmapEffect to create Shadow effect.
The documentation and an example can be found here.
hai guys
i need your help to create a rectangle button with xaml.
if we create a default button will rounded rectangle button.
and i not found corner radius setting..
please help me..
You have to create your own Style for your button.
Take a loot at this example, and then you can play with RadiusX RadiusY properties of both Rectangles to avoid rounded rectangle.
Your basic style would be:
<Rectangle>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Rectangle>
That would be a very basic button style that has rect corners. I still suggest to read blurg's link for more info, as this can be very flexible and/or complex ;)
Cheers.
Take a look at the MSDN example for creating fancy buttons here. Also take a look at the answer to this question.