xaml,windows-phone-8.1,winrt-xaml , Remove blank space from Pivot Item in Windows Phone 8.1 App


Remove blank space from Pivot Item in Windows Phone 8.1 App

Question:

Tag: xaml,windows-phone-8.1,winrt-xaml

How to get rid of the blank space between a pivots item and the pivots borders?
I tried setting the margin and the padding to 0 but it does not help much. The reason I want to do this is the following - I figured that changing the template of the pivot to have a static ( not moving) header for three items is a bit hard and therefore I just put a StackPanel with three buttons above the pivot with three items, and I would manually select the pivot item in code behind when someone pushes the button. This approach is good enough for me, but has a certain flaw- a blank space between the items and the StackPannel , how can I remove it ?

<StackPanel Orientation="Vertical">
    <StackPanel Orientation="Horizontal"> 
        <Button Click="Button_Click"/> 
        <Button Click="Button_Click_1"/> 
        <Button Click="Button_Click_2"/> 
    </StackPanel>
    <Pivot>
        <PivotItem>
            <local:someControl /> 
        </PivotItem>
        <PivotItem>
            <local:someControl />
        </PivotItem>
        <PivotItem>
            <local:someControl /> 
        </PivotItem>
    </Pivot>
</StackPanel>

Answer:

You can use negative value as margin to remove that blank space. Simply try

<Pivot Margin="0, -25, 0, 0">

Replace 25 with your desired value.


Related:


Adding table header to Listview with DataTemplate in XAML


c#,wpf,xaml,listview,windows-runtime
In my Xaml I'm binding some data from a wcf. I don't know how to add some table headers to the columns. Also the data in the columns is not well aligned, I'm thinking it's because of the ColumnDefinition Width="auto". I want the columns to be aligned like in the...

How to get data from combobox from datagrid in WPF?


c#,wpf,xaml
I have been looking for a way to get data out from this datagrid combobox that i made. Specifically the selected value of every combobox from columns. I am new to WPF and would be really grateful if someone would help. Thanks XAML: <DataGrid x:Name="tb" Margin="5,51,5,5" ItemsSource="{Binding}" AutoGenerateColumns="False"> <DataGrid.Columns> <DataGridTextColumn...

Setting App.xaml-resources' value from codebehind


c#,wpf,xaml
I implemented a theme system for my program, and I read the theme from a file at startup. Basically in my App.xaml I have a bunch of <Colors/> with specific keys which I set the value of in code-behind when starting the program in App.xaml.cs.Main(); Here's what it looks like:...

Slider progress bar with MediaElement Windows Phone 8.1


c#,xaml,slider,windows-phone-8.1,mediaelement
I am working within a Windows Phone 8.1 (non SilverLight) application. I have a MediaElement AudioPlayer that plays audio files. I also have a Slider AudioPlayerSeek that I want 'hooked' to the MediaElement, so that it moves as the audio is playing. I have gone through this tutorial word for...

ItemsSource bind to collection stays empty


c#,wpf,xaml,mvvm
I have a class YouTubeVideo which contains some variables, which I would like to show on the UI. Therefore I created a custom control which shows all the data of the class. There are more than one instances of the class, so I would like to use an ItemsControl to...

How to hide app bar button in different hub sections windows phone?


c#,xaml,windows-phone-8.1
i am new to c#. as i move on subsection the app bars stays the same only on the 3rd subsection that one button is hidden. please help... HubPage.xaml <CommandBar x:Name="mybar" ClosedDisplayMode="Minimal" > <CommandBar.SecondaryCommands> <AppBarButton Label="setting" Click="AppBarButton_Click"/> </CommandBar.SecondaryCommands> <AppBarButton x:Uid="CALENDAR" Label="calendar" Click="AppBarButton_Click"> <AppBarButton.Icon> <SymbolIcon x:Name="btnCalendar" Symbol="Calendar"/> </AppBarButton.Icon>...

WPF Rotate an Image and align it


wpf,xaml,rotation,rendertransform
I've an Image component where I want to rotate the source : <Image Name="ImageTarget" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Uniform" RenderTransformOrigin=".5,.5"> <Image.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="{Binding Main.BindedViewMode, Converter={StaticResource ImageSizeConverter}}" /> <ScaleTransform ScaleY="{Binding Main.BindedViewMode, Converter={StaticResource ImageSizeConverter}}" /> <RotateTransform Angle="-90" /> </TransformGroup>...

windows phone: deserialise and store both json key and value to modal


c#,windows-phone-8,windows-7,windows-phone-8.1,json-deserialization
Hello guyzzzz i want to store both key and value in modal class...below is my json.. { "Example": [ { "Invoice": { "TFDGFF": " 200", "BF": " 200", "MD": "10", "EFM": " 12", "ATT": "4" }, "TF": "200" }, { "Invoice": { "DF": " 49", "DR": " 49", "KJ": "4",...

Items inside custom panel not getting arranged properly


c#,wpf,xaml
Hello I need a view with multiple columns and variable height rows. I have written a custom WrapPanel which is working properly if its children are explicitly given. The problem arises when I provide an ItemsControl with UserControl in the DataTemplate as the WrapPanel's child. My CustomWrapPanel: public class NewsFeedPanel...

How to get info about previous page on Frame.GoBack()


c#,navigation,windows-phone-8.1
Say we have some Page PageA and I have a button that, when clicked, does the following: Frame.NavigateTo(typeof(PageB)); After the user is done doing stuff, he navigates back from PageB to PageA calling Frame.GoBack() I want be able to determine that I'm navigating back from PageB I could use: protected...

changing image background in button does not work


c#,windows-phone-8.1,.net-4.5
I want to toggle button's image on each click. My code looks like this: private void k1_Click(object sender, RoutedEventArgs e) { bk1 = !bk1; k1.Content = bk1.ToString(); var uriString = bk1 ? @"Assets/image1.png" : @"Assets/image2.png"; k1.Background = new ImageBrush { ImageSource = new BitmapImage(new Uri(uriString, UriKind.Relative)) }; } When I...

Filtering ObservableCollection with ICollectionView


c#,wpf,xaml,mvvm,data-binding
I have ObservableCollection binded to dataGrid and now I want to filter the presented data I see that I need to use ICollectionView but I am not sure how to add ICollectionView with my MVVM pattern. My code simplified looks following: public class MainViewModel : ViewModelBase , IBarcodeHandler { public...

Custom WPF DataGrid with optional button column


c#,wpf,xaml,datagrid,custom-controls
I am creating a custom DataGrid control which has a property, ShowCloneColumn. If you set this property to true the DataGrid should add another column with a Button. The class I've created derives from DataGrid and implemented a Dependency Property, ShowCloneColumn. public static readonly DependencyProperty ShowCloneColumnProperty = DependencyProperty.Register("ShowCloneColumn", typeof(bool), typeof(CloneRowDataGrid),...

play audio periodically from a memory stream c#


c#,audio,windows-phone-8.1,memorystream
I have some buffer containing samples of sinus which I want to be played from a memory stream periodically. Is there any efficient way to play it without having gaps in time? I try to make my own signal generator (I know that are some libraries providing that but I...

WPF bindings do not pick up any changes


c#,wpf,xaml,mvvm,inotifypropertychanged
In my WPF application, I have some properties which I have bound to the XAML counterpart, but for some reason do not get set whenever their values change. I have implemented the INotifyPropertyChanged interface as well as set my DataContext for this View too, and it is still not picking...

Overlapping Items in WPF ItemsControl


c#,wpf,xaml,user-interface,datatemplate
I am having a problem with DataTemplates used in a WPF ItemsControl. I want to be able to "bring forward" any of the items in the list so that they are on top of everything else in the list, but haven't had any luck. Here's a simple example that illustrates...

Enable drag/drop and reordering after long click on GridView control (XAML)


c#,xaml,windows-store-apps
I'm using the Items Page template from the Windows 8.1 Windows Store Apps templates in XAML. The page features a large GridView control with multiple item elements. I would like to enable the dragging and reordering of items, but only after a user long clicks one of the items (similar...

unable to add reference to windows.media.speechsynthesis.dll


windows-phone-8.1,text-to-speech,system.windows.media
I am working on text to speech conversion in windows 8.1 (silverlight) and i need to access the SynthesizeTextToStreamAsync method for which I need to add reference to Windows.media.speechSynthesis. I am unable to add this reference to my project it shows me error message as A reference to a higher...

Aligning StackPanel to top-center in Canvas


c#,wpf,xaml,canvas
I'm trying to create an application which is supposed to measure quick reaction performance of it's user. The application starts up in full-screen mode and resizes it's elements accordingly to the screen resolution. The project was strongly inspired by training_aim_csgo2 map. It's mostly done, but here is the problem: I...

while Inherit style in WPF it affect parent style


c#,xaml,styles,wpf-controls
In WPF i have a style for the control like below, <Style TargetType="local:CustomControl"> <Setter Property="Background" Value="Transparent" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="BorderThickness" Value="0,0,0,1" /> <Setter Property="Padding" Value="3,0,3,0" /> <Setter Property="IsTabStop" Value="False" /> <Setter Property="VerticalContentAlignment" Value="Center" /> </Style> Now i need to override customcontrol border for some other place like...

WPF/XAML ResourceDictionary with blank space


c#,wpf,xaml
I am using af ResourceDictionary for translating <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:System="clr-namespace:System;assembly=mscorlib"> <System:String x:Key="NumStartsTotal">Total: </System:String> </ResourceDictionary> I access it like this: <TextBlock Text="{DynamicResource NumStartsTotal}" /> I would like the output to be "Total: " (with the blank space), but it comes out "Total:" (without the blank...

HorizontalContentAlignment does not appear


wpf,xaml
I have the following code in my .xaml: <StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Background="Yellow" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,2,2,0" Name="MainButtonsPanel" Width="100" > <Button Name="ButtonSaveChanges" Background="LightGray" Width="100" Height="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}" Command="{Binding MyCommand}" CommandParameter="{Binding}" Visibility="Visible" /> <Button Name="ButtonEdit" Background="Gray" Width="100"...

Single sign on single native client windows phone using ADAL


windows-phone-8.1,single-sign-on,adal
We have a windows phone native app (and building for android, iOS also) which uses ADAL to get token for ex:graph. ADAL is asking for credentials for the first time. Now inside of this native app on some frame we have a WebView control which launches another website (our own)...

Stream.CopyTo(newStream) return Length 0


audio,windows-phone-8.1,memorystream
I try to make some concatenation of buffers which are saved in a memory streams. Then, when I'm trying to play the whole buffer it gives an exception: An exception of type 'System.ArgumentException' occurred in Microsoft.Xna.Framework.ni.dll but was not handled in user code Additional information: Ensure that the buffer length...

Style vs inline property setting in silverlight with a custom control


c#,wpf,xaml,silverlight
I have a custom silverlight control that is pretty much a glorified text box. I have some properties in it I need to be able to set from the XAML in silverlight, so for each property I have created something like this: public bool UseCustomTooltips { get { return _useCustomTooltips;...

Windows Phone 8.1 get image from base64 string


c#,image,windows-phone-8.1
How can i get an Image from a base64 string on Windows Phone 8.1? I know how to decode the image if that helps? var imageBytes = Convert.FromBase64String(base64StringWithImageData); var ms = new MemoryStream(imageBytes, 0, imageBytes.Length); var decoder = await BitmapDecoder.CreateAsync(BitmapDecoder.PngDecoderId, ms.AsRandomAccessStream()); But nowhere have i found how i can get...

C# XAML - How to add a combobox to some datagrid ROWS but not others?


c#,wpf,xaml,datagrid,combobox
I'm using a key/value observable collection to hold data which is represented in the view by a two column datagrid. Some key values contain a list of items and other key values contain a single string value. Using the below code snippet I'm able to display those key values with...

windows phone 8.1: Hide stackpanel if textblock is empty


c#,xaml,windows-phone-8,windows-phone-8.1,visualstatemanager
my xaml code is given below my whole xaml <Page x:Class="App13.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App13" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:converter="using:App13" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <Page.Resources>...

ViewModel Called on Navigation Back Prism MVVM Windows Phone 8.1 C#


c#,xaml,mvvm,windows-phone-8.1,prism
I'm working on an application and everything works fine but when I go back to the previous page the View Model is called so it will not maintain the old data. I use this line to call My View Model in XAML. prismmvvm:ViewModelLocator.AutoWireViewModel="true" So my question is: How do I...

BooleanToVisibilityConverter works on Textblock and not on UserControl


wpf,xaml,binding,windows-phone-8.1
I'm working on a windows phone project. There is something i don't really understand about my xaml. Here it is: <Page x:Class="CitiBox.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:converters="using:CitiBox.Converters" xmlns:views="using:CitiBox.Views" mc:Ignorable="d" Background="{ThemeResource...

Backbutton press navigates to two page backward in Windows Phone App


c#,xaml,windows-phone-8
In my windows phone app sometimes it takes me two page backward although I pressed hardware back button just once. To handle the back button I used following code snippet: private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e) { e.Handled = true; if (Frame.CanGoBack) Frame.GoBack(); } And in OnNavigatedTo() method I added...

Zoom into ListView contents without also scaling scroll bars


c#,wpf,xaml,scaletransform
I have a GridView in a ListView. I want to add a Ctrl+MWheelUp zoom to the contents. I've achieved the zoom part using a ScaleTransform with the below code, however, as this is applied to the ListView as a whole, it also scales the scroll bars. Ideally, I'd like scrollbars...

Checkbox checked event not firing in wpf


c#,wpf,xaml
hi in my form(adminentitylist.xaml) file contains the code is below <ResourceDictionary xmlns:local="clr-namespace:iWatch.Administration" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" xmlns:my="clr-namespace:iWatch.UILibrary;assembly=UILibrary"...

How can i make this CommandParameter work?


c#,wpf,xaml,binding,commandparameter
I've been learning WPF in college this semester but there are still some things I do not fully understand. I have the following code: <UserControl x:Class="Reversi.SquareControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="48" d:DesignWidth="48"> <Button Command="{Binding Place}"...

WrapPanel grabs focus from its children


c#,xaml,silverlight
I have some (homemade) controls in a wrappanel in a scrollviewer and I want my controls to get focus when I click on them or Tab through them. But the wrappanel grabs the focus and hands it to Children[0]. <ScrollViewer IsTabStop="False" > <toolkit:WrapPanel> <!-- children, filled in from code. IsTabStop="True"...

Get rid of Visual Studio Namespace error message


c#,.net,wpf,xaml,namespaces
this is unfortunately a very beginner question: I am doing the very simple WPF tutorials and I am stuck on a namespace problem. I want to do a simple hierarchical treeview binding on a custom object according to the tutorial. I put the object into a custom namespace "MyNameSpace" and...

Add image to the radio button


c#,wpf,xaml
<StackPanel Name="StpAddDel" Orientation="Horizontal" HorizontalAlignment="Right" Margin="5"> <RadioButton Name="rdbactive" Content="Active" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="50" Height="15" Foreground="Blue"/> <RadioButton Name="rdbinactive" Content="InActive" GroupName="actinact" VerticalAlignment="Center" Margin="5,0" Width="60" Height="15" Foreground="Blue"/> <Button Name="BtnAdd" Height="20" Width="20" Margin="5,0" Template="{StaticResource AddImgBtnTemplate}" />...

Gracefully handling expected BindingExpression errors


wpf,xaml,data-binding,wpf-controls
I have a ComboBox bound to an ObservableCollection where the DisplayMemberPath references an object property Url. My CompositeCollection contains a null item, allowing the user to have an optional selection: <ComboBox Grid.Row="7" Grid.Column="1" Height="24" VerticalAlignment="Top" IsSynchronizedWithCurrentItem="True" SelectedItem="{Binding SelectedNotificationServer, Mode=TwoWay}" DisplayMemberPath="Url"> <ComboBox.Resources> <CollectionViewSource x:Key="comboBoxSource" Source="{Binding Path=NotificationServers}" />...

How do you calculate pixel size of string?


c#,windows-phone-8.1,windows-8.1,windows-universal
I have a string. I know the font family and the font size it is going to be displayed in. I need to know how many pixels the text will take up in the ui. So that I can determine whether to show another element. How would I do that?...

Datagrid inside a Custom control is not updating


c#,wpf,xaml,datagrid
In my Custom Control that have a DataGrid and two buttons, one for add rows in this DataGrid and other button to remove elements. (because of my reputation I can not post an image here, sorry!) :-( My Custom Control code behind: /// <summary> /// Interaction logic for UserControl1.xaml ///...

Setting binding on usercontrol to mainwindow's ViewModel


.net,wpf,xaml,mvvm,data-binding
I have following user control <UserControl x:Class="Station.Controls.FilterTraceDataControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d"> <TextBox x:Name="PartNumbTextBox" Width="120" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="5,0,0,0" Height="25"/>...

Caching Views in XAML changes appearance?


xaml,caching,windows-store-apps
I'm caching Views in XAML in order to improve performance (don't need to load the controls again). Does this make sense / improve performance of loading controls? Problem is, although I'm caching / loading the same thing, it seems when I use the Cached View, it has a different appearance....

Is it possible to concactenate a DataBound value with a constant string in XAML DataBinding?


c#,xaml,windows-phone
To bind a value to a TextBlock we use the following syntax to display an <ItemName> property of a bounded object. <TextBlock Text="{Binding Path=ItemName}" /> But is there a syntax to use the above tag to concatenate the constant string 'Item' with the databounded property, in order display something like:...

Change the Location of DefaultPage in Universal App


c#,xaml,win-universal-app
How can I change the location of the default MainPage.xaml in an Universal Windows App? I want to have in the Windows and WindowsPhone Project a subfolder named "View" where I save the MainPage.xaml file like this example.  - Windows Project  -- View  --- MainPage.xaml  - WindowsPhone Project  -- View...

WPF expander not expanded above buttons make buttons unclickable


wpf,xaml,clickable,expander
In a WPF form, I have an expander that expands above other controls, such as buttons : <Expander Grid.Row="0" Panel.ZIndex="99" Name="searchMenuExpander" Header="Search menu" FontWeight="Bold" HorizontalAlignment="Stretch" Margin="10,10,0,0" MinWidth="510" MinHeight="200" VerticalAlignment="Top" Foreground="MidnightBlue" Cursor="Arrow"> <Grid Background="White"> <Border HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <TextBlock Text="Name" HorizontalAlignment="Left" VerticalAlignment="Top"...