I have a simple splitview that has a rectangle of width 4px that indicates the selected item in the spiltview.
<Rectangle HorizontalAlignment="Left" VerticalAlignment="Top"
Width="4" Height="48" Margin="1,0"
Fill="{ThemeResource SystemAccentColor}" Grid.Row="2"
Visibility="{x:Bind btnHome.IsChecked, Mode=OneWay}"/>
Right now I've multiple rectangles turned on/off depending whether the checkbox is selected or not! But instead, I want a single rectangle in my code that should transition from the place where it previously was to place where the user has clicked.
Simplest for you would be using the new NavigationView if your minimum version is set to Fall Creators Update or use the HamburgerMenu control from UWP Community Toolkit (note that it's updated to use style very similar to yours, the docs aren't just updated with current screenshots). You can download the UWP Community Toolkit Sample App from Windows Store if you want to see how it currently looks.
If you want to use your custom solution, you should create a custom style or rather edit an existing style of the control you're using as hamburger menu items. Default styles are available for example here.
Related
I am currently working on a Splitview Control which contains some menu options in SplitView Pane and a Grid in SplitView Content section. When the split view pane is opened its content gets hidden. Is it possible to move that slightly left like the following screenshot?
My basic split view implementation is
<SplitView x:Name="OptionsSplitView" OpenPaneLength="200" PanePlacement="Right"
DisplayMode="Overlay">
<SplitView.Pane>
<ListView x:Name="OptionsList"
Margin="10,10,0,0"
Grid.Row="1"
VerticalAlignment="Center"
ItemContainerStyle="{StaticResource GenericListViewContainerStyle}"
ItemTemplate="{StaticResource OptionsListItemTemplate}"
SelectionChanged="OptionsList_SelectionChanged">
</ListView>
</SplitView.Pane>
<SplitView.Content>
<Grid/>
</SplitView.Content>
</SplitView>
Please suggest is it possible to customize split view as per screenshot?
Bingo,
You can achieve it by just setting Right Margin of content whenever Pane Open or close.
Do refer Below link to get pane open & close event.
(Windows 10 UWP) SplitView.PaneClosed event is available but not for PaneOpened
Change your Splitview DisplayMode option to CompactInline or CompactOverlay as per your requirement
Any one knows how to show the slider tool tip on Windows Phone 8.1 WinRT? I have checked the property IsThumbToolTipEnabled but no tool tip is shown. I couldn't find any resources on how to do this on phone. Any clue?
Set a custom template and use the tooltipservice api.
First, edit the style for a slider. Next find the <Thumb> Element. This code will work and show the text, and you can use binding for the text value.
<Thumb>
<ToolTipService.ToolTip>
<TextBlock Text="Your text"/>
</ToolTipService.ToolTip>
</Thumb>
I am workng on windows 8 app getting problem to use text watermark to text box, can anybody help me to find out how we can apply water mark init .
below is the code of my text box.
<TextBox x:Name="txtUserName" Width="351" Height="45" BorderBrush="Gray" BorderThickness="2" Background="{x:Null}"/>
Use
<TextBox Width="250" Name="_txtBox" PlaceholderText="Please enter CS#"/>
you can use Callisto toolkit for windows 8 it has watermark textbox control. you can install it from nuget package manager.
use this namespace in your page..
xmlns:CallistoControls="using:Callisto.Controls"
use the control like this.
<CallistoControls:WatermarkTextBox Watermark="Type to message" HorizontalAlignment="Stretch" TextWrapping="Wrap" AcceptsReturn="True" MaxHeight="100" Padding="5,5,20,30" />
there are other useful controls too. hope this helps you
There's no way to do it without using a third-party library or overriding the text box and creating your own "Watermark Text Box" class. You just listen for the got/lost focus events and display your text appropriately.
If you don't want to rely on 3rd party SDKs, you can create your own. Check out these tutorials.
Create Your First WinRT WatermarkTextBox Control
Watermark TextBox in Windows Store apps
WaterMarkTextbox Control in Windows Store Application Using XAML
I'm creating this test Metro application using Windows 8, VS2012, C# and XAML. There are different TextBox in the application page arranged in a StackPanel. When the application is launched the focus is on the first TextBox.
I was wondering how to "deactivate" this.
Here's a pic, as you can see the first field is focused (color changed and ToolTip displayed).
When your UI is loaded you can remove focus from the TextBox by applying a Programmatic focus state to any other control.
Imagine that you have a Button named myButton. You can:
myButton.Focus(FocusState.Programmatic);
You cannot however use FocusState.Unfocused state to remove focus from the TextBlock because it is not allowed and will throw an exception.
One simple fix for this is place something to catch it first with IsTabStop="True" with a 0 Opacity which is a bit hacky but the only way I know. So something like;
<TextBox IsTabStop="True" Opacity="0" Height="1" Width="1"/>
<!-- Then the rest of your content like your other TextBox stuff -->
Currently porting an application to Windows Phone 7 I've encountered a problem that should be trivial
All I want is change the background colour of a TextBlock.
Using the WYSIWYG I can easily create a TextBlock, change the foreground and background colour.
So for a TextBlock using white text on black background I would use:
<TextBox Height="148" HorizontalAlignment="Left" Margin="106,0,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="460" Background="Black" BorderBrush="Black" Foreground="White" />
But I need to do it in code (C#) and the Background doesn't appear to be a property of TextBlock.
How come it's something you can do using the resource editor, but not in code?
I've found various similar questions, but no definitive answer.
In Microsoft documentation (.Net), TextBlock does appear to have a Background property
Is there a way to do this in code without having to put the TextBlock inside a container (like Grid) which does have the Background property?
Thanks
JY
TextBlock is not inherited from Control, it doesn't have a Background property. The code you are showing is a TextBox not a TextBlock. TextBox inherites from Control and has a Background property. The simplest way is to wrap it with a Panel, or you can create a custom control for it.
Also, in silverilght sdk, you have a control called Label and it is inherited from Control. You can probably get the source code from there and implement it in your project.