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.
Related
Is there an easy way to get the content (text) on the left side of a ToggleSwitch control? (Else than messing up the Template).
Thanks
You should alter the template if you want to do it correctly.
However, if you want to fix it in a hacky way, change the FlowDirection of the control. But then you'll have to tweak with margins and alignments to make it look decent when used with other controls (see image below for default alignment).
<StackPanel>
<ToggleSwitch OffContent="Test" OnContent="Test2"></ToggleSwitch>
<ToggleSwitch OffContent="Test" OnContent="Test2" FlowDirection="RightToLeft"></ToggleSwitch>
</StackPanel>
A modified template displaying SwitchToggle content on the left can be found here.
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"/>
I have been trying to customize the Background color of ScrollBar in Windows Stores Apps. But its not working. I have a doubt whether is it a limitation in WinRT?
Thanks in Advance.
My Code Snippet:
If you want to change the Background color of the ScrollBar, you need to change the default style of the Scrollbar and the Blend for Visual Studio can help you implement it very easily.
For how to changing the style of the Scrollbar, please first please right-click the Scrollbar control-->click "Edit Template"-->"Edit a Copy", after that you will see all the style which creates the Scrollbar, then please find the following xaml and change the "Fill" property of the "Rectangle" with the Background color which you want, in this way it will change the Background color of the ScrollBar:
<Rectangle Fill="Yellow" Margin="0" Grid.RowSpan="5" Stroke="{ThemeResource ScrollBarTrackBorderThemeBrush}" StrokeThickness="{ThemeResource ScrollBarTrackBorderThemeThickness}"/>
Is there any way I can add a stroke to the letters of a TextBlock, but I can't seem to figure out the properties:
<TextBlock Text="Hello World">
<TextBlock.Resources>
<Stroke ?>
I cant seem to find the right documentation, as I suspect is not the same as the WPF?
Kent Boogaart solved your conundrum in 2008. Please redirect your focus to his nice answer:
Apply stroke to a textblock in WPF
Hope it helps!
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.