FAQ Database Discussion Community


Circular progress bar in windows phone 8

c#,xaml,windows-phone-8,progress-bar
In referencing https://github.com/asimmittal/SillyUIControls/tree/master/CircularProgressBarWP8 for a fun new implementation of a progress indicator, I would like to adapt the circular progreessbar control to Windows Phone 8. But when i downloaded the project and rebuild-ed , it gave compile time error. error is as follow The property 'BgBrush' does not exist on...

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...

Windows 10 xaml Controls Centre Screen

xaml,user-interface,windows-universal,windows-10
I'm working on an app for windows 10. I've previously worked on a handful of Windows 7 applications and I'm trying to get use to the many differences now. I'm trying my luck at a universal app, and I'm wanting to centre a handful of controls so that no matter...

Why does the VisualTreeHelper return a border for a button

c#,wpf,xaml,hittest
I am using the VisualTreeHelper to perform a HitTest on a button that looks like this... <Button Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Purple"> Hello world </Button> However when I perform the actual HitTest as such: HitTestResult result = VisualTreeHelper.HitTest(_ContentHolder, new Point(xTransform, yTransform)); if (result != null) { } The returned object...

WP 8.1 ToggleButton Change Icon when Checked / UnChecked

xaml,windows-phone-8.1,togglebutton
I have the following XAML code for Windows Phone 8.1 (non SilverLight): <Grid> <ToggleButton Name="TogBtn" VerticalAlignment="Center" HorizontalAlignment="Center" Checked="ToggleButton_OnChecked"> <SymbolIcon Symbol="play"></SymbolIcon> </ToggleButton> </Grid> The output of the above code is: How can I change the icon to a stop icon when the toggle button is checked and then back to play...

Binding property of usercontrol to data

c#,xaml,mvvm,binding,winrt-xaml
I'm not sure of the correct terminology to use. I created a Windows Store app about a year ago and the main page was created by Visual Studio and I never changed it much. It uses a view model that works fine but I don't know enough to fix problems....

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"/>...

How do I, or can I use a static resource for the StringFormat on a TextBlock?

c#,wpf,xaml,string-formatting
I have a text block that is displaying the date/time. The look of the clock may be different on some controls in the application, as far as color and maybe font, but I want the date and time to have the same format. I know I can set the StringFormat...

WPF Interactions CallMethodAction for DataTemplate in ListCheckBox thrown a exception “Could not find method on object of type”

c#,wpf,xaml,checkbox,listbox
I'm trying to use interactions, but I can't write ordered params in my method in ViewModel. I'm use a ListBox who have items inner a checkbox and another controls. So I trying to use the different combinations of params TargetObject of CallMathodAction in my usercontrol, but I can't get the...

Disable/Enable context menu item depending on listview item

c#,.net,wpf,xaml,contextmenu
I have a UserControl with a ListView in it. In addition I have a class listViewItems.cs with a DisplayMemberBinding to a GridView in listView. Each ListView-Item has a context-menu. Now I'm trying to enable/disable the context-menu-items depending if a value in class ListViewItems is null I've tried a binding to...

Change image.Source in ListView according to boolean

c#,wpf,xaml,listview,boolean
I have a listview with 2 columns: "visibility" and "name" of a system. The value of column 1: a button (btn_visibility) with an image (img_visibility). Depending on a boolean (true or false) from an object in code behind the image should change, e.g. SYSTEM.SHOW_IN_LIST = true; img_visibility.Source = new BitmapImage(new...

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 Add Click event in Stack Layout or Frame

android,ios,xaml,xamarin,xamarin.forms
I am new in xamarin.forms please help me out how i can add click event in Stack Layout or Frame <Frame Grid.Column="0" BackgroundColor="#ffffff" Grid.Row="0" HasShadow="true" OutlineColor = "Black"> </Frame> <StackLayout Grid.Column="0" BackgroundColor="#313FA0" Grid.Row="0"> </StackLayout> ...

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;...

What am I doing wrong so the data binding target doesn't get affected by data binding source

c#,.net,wpf,xaml,data-binding
I've recently moved from Windows Forms to WPF. I started with Reed Copsey's series 'Better User and Developer Experiences – From Windows Forms to WPF with MVVM'. On the 4th part of the series, the following code should fill text boxes with data: <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=Feed.Title, Mode=OneWay}" />...

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...

Referencing event from .xaml file in .fs file

wpf,xaml,f#,fsxaml
I want to declare an event in a XAML file and then add a handler in a fs file. The upper part of the XAML file would be something like (MouseRightButtonDown): <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="AboutStack" MouseRightButtonDown="AboutStack_MouseRightButtonDown" Title="About" SizeToContent="WidthAndHeight"> <StackPanel>... The F# file contains: open FsXaml type MainWindow = XAML<"MainWindow.xaml", true>...

Saving WPF Assets

wpf,xaml,assets
I am creating a WPF app where I'd like to create an Assets folder which will contain my images etc, then access them via a relative path, if possible. Assuming my folder structure is as follows: Application > Bin > Debug > EXE Where should I create my Assets folder?...

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...

How to navigate to page when GridViewItem is clicked?

c#,xaml
I have a GridView which contains 2 items defined as follow : <GridView Name="Grd1" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Row="1" Width="Auto" SelectionMode="None" IsItemClickEnabled="True" ItemClick="GridViewItem_Click"> <GridView.ItemsPanel> <ItemsPanelTemplate> <WrapGrid Orientation="Horizontal" Width="Auto"/> </ItemsPanelTemplate> </GridView.ItemsPanel> <GridViewItem Name ="GrdI1"> <StackPanel> <Image HorizontalAlignment="Center" Height="100" Width="100"...

TargetType does not match type of element

wpf,xaml
I have a simply buttonStyle defined for TargetType of Button; but setting the style to button gives an exeption. <Window> <Window.Resources> <Style x:Key="buttonStyle" TargetType="{x:Type Button}"> <Setter Property="Background" Value="Magenta"/> </Style> </Window.Resources> <StackPanel Orientation="Horizontal"> <Button Content="1" FocusVisualStyle="{StaticResource buttonStyle}"/> </StackPanel> </Window> Additional information: 'Button' TargetType does not match type of element...

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...

Change default bitmap in CheckBox

c#,wpf,xaml
I find solution Setter.TargetName does not work against an element from the BasedOn setting. But I do not understand how prement him to me. I have a class: public class MyCheckBox: CheckBox { public bool DefaultValue { get { return (bool)GetValue(DefaultValueProperty); } set { SetValue(DefaultValueProperty, value); } } public static...

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...

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 to call StyleSelector on PropertyChanges of a row

c#,.net,wpf,xaml,mvvm
I have RowStyleSelector with datagrid. It's called correctly on load of the window. On changes of rows when I call PropertyChange it's not called. <DataGrid Grid.Row="2" ColumnWidth="*" ItemsSource="{Binding TraceItemCollectionViewSource , Mode=TwoWay , UpdateSourceTrigger=PropertyChanged}" EnableRowVirtualization="false" RowStyleSelector="{StaticResource TraceRowStyleSelector}" IsReadOnly="True" Name="TraceDataGrid" Margin="5,5,5,5" Padding="5,5,5,5" AutoGenerateColumns="False"> This is my model: public class TraceDataItem :...

How to get the device orientation changed event under Windows Phone

c#,xaml,windows-phone,windows-phone-8.1
With windows phone, is there an event I can register for when the device entered landscape mode? The reason why I am asking this is because we have a view with an input box. And when in landscape mode, the TextBox is partially blocked by the keyboard. So I am...

Visual studio extension resource files

c#,wpf,visual-studio,xaml,resourcedictionary
I have developed a visual studio extension and I have a custom button that I want to style using PNG images, but the image files/resource files wont show while in action and the button is blank. I have a custom button template. <Style x:Key="openFilebtn" TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate...

How to bind a textblock visibility to another textblock text property

c#,xaml,windows-phone-8,windows-phone-8.1,winrt-xaml
<Grid Height="{Binding ElementName=oldPrice, Path=Height}"> <TextBlock VerticalAlignment="Bottom" FontSize="{StaticResource TextStyleSmallFontSize}" RequestedTheme="Light" FontWeight="Bold" Foreground="#B0B0B0" Style="{StaticResource TitleTextBlockStyle}" TextWrapping="NoWrap"> <Run x:Name="oldPrice" Text="{Binding oldPrice}" /> </TextBlock> <Line Stretch="Fill" Stroke="#B0B0B0" StrokeThickness="1" X1="1" Width="{Binding ElementName=oldPrice, Path=Width}" Height="{Binding ElementName=oldPrice,...

Cannot find XAML element names in code behind on Release

c#,wpf,xaml,visual-studio-2013
As described in my previous question my problem started with CefSharp wanting to explicitly select platform x86 or x64. This resulted in several errors where in code behind none of the XAML elements could be found, including InitializeComponent();. I removed CefSharp and set to AnyCPU again. Now Debug mode works...

Enumerate and apply WPF styles programmatically

c#,wpf,xaml,storyboard,styling
I have a WPF button as such <Button Name="HelloWorldButton" Width="100" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" Style="{StaticResource TileButton}"> Hello world </Button> Using WPF styling I have applied a style template as shown below <Style x:Key="TileButton" TargetType="Button"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <Border x:Name="focusRect" Margin="-6" BorderThickness="6"> <ContentPresenter />...

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"...

Comparing Button.Background with Colors

c#,xaml,winrt-xaml
I am building a Windows Store application. I am facing a problem when trying to compare the background with a color. What My Program Does. There are many buttons on the screen and on a click of any button it changes the background color of it to either red or...

How to change mediaelement to scale in portrait and fullscreen in landscape mode on Windows Phone 8.1?

c#,.net,xaml,windows-phone-8.1
I am having difficulty trying to change the <mediaelement /> to fullscreen automatically when the phone is rotated in landscape mode. Right now, the video will play fullscreen when I tap the lower right button that scales to full screen when I tap on it, but I don't want that....

DataTemplate doesn't seem to be binding

wpf,xaml,datatemplate,itemssource
I'm filling a ListBox with items from a bound model. While testing I had this: <ListBox x:Name="SettingsHolder" Margin="5,8,5,5" ItemsSource="{Binding AllSettingItems}" Height="380" DisplayMemberPath="Display"/> By binding directly to a member of item objects in ItemsSource, I was able to see I was loading the list box properly. In fact, the 'Display' member...

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...

How to map tapped event for a single object in a canvas control in XAML?

c#,xaml,canvas,foreach
I am working on a windows phone RT XAML c# project. I have a canvas filled with several dynamically added balls(ellipse) as ContentControl. I want that, when a ball is tapped, only that particular ball should animate. I have used storyboard animation in the animating function animateBall() and the animation...

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>...

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...

Caliburn.Micro attach event handler on event of Behavior

c#,xaml,winrt-xaml,caliburn.micro,behavior
I wrote my own Behavior to handle a swipe gesture and put it to the ItemTemplate of a ListView. If a swipe is completed, I raise an event for LeftSwipe or RightSwipe. This event should be handled by my ViewModel. I use the syntax of Caliburn.Micro to attach handler to...

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:...

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"...

Table user control not displaying

wpf,xaml
I am trying to create a usercontrol that would only contain a table but the table does not appear, it only says "System.Windows.Documents.Table". I am creating the user control and putting a table in it like this: <UserControl x:Class="WpfApplication4.TestTableControl" 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"...

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...

ItemsWrapGrid Order in Windows Phone 8.1

c#,xaml,listview,windows-phone-8.1
I have the following sample data setup in my XAML: <vm:SoundModel.Animals> <vm:SoundGroup Title="Animals"> <vm:SoundGroup.Items> <vm:SoundData Title="Animal 1" FilePath="Animal1.wav" /> <vm:SoundData Title="Animal 2" FilePath="Animal2.wav" /> <vm:SoundData Title="Animal 3" FilePath="Animal3.wav" /> </vm:SoundGroup.Items> </vm:SoundGroup> </vm:SoundModel.Animals> And in my XAML I have the following: <Page.Resources> <DataTemplate x:Key="SoundTileDataTemplate"> <Grid...

In pure XAML, is it possible to select a string format on the fly?

c#,wpf,xaml,.net-4.5
I have to display a decimal representing a price. If the price is in British Pence or Yen, it needs to display it to 4 decimal places, otherwise it needs to display it to 6 decimal places. The currency is encoded as a string, and will be GBp or YEN...

Silverlight Nested Custom Controls results in StackOverflowException

c#,xaml,silverlight,controls,stack-overflow
iam writing a reusable Controllibrary for my Silverlight Projects. At the moment i get an StackOverflowException each Time i startup my test Application wich is using the Controllibrary. I was able to reproduce the Exception in a small sample Projekt. I have two simple Custom Controls: //Control1.cs public class Control1:Control...

How to successfully implement WPF textbox validation?

c#,wpf,validation,xaml,visual-studio-2012
I'm trying to implement what should be simple textbox validation for a WPF application, but I'm having some problems. I used this guide: http://www.codeproject.com/Tips/690130/Simple-Validation-in-WPF My textbox in MainWindow.xaml: <TextBox x:Name="textbox1" HorizontalAlignment="Left" Height="23" Margin="93,111,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="120" Style="{StaticResource textBoxInError}" Validation.ErrorTemplate="{StaticResource validationErrorTemplate}"> <TextBox.Text> <Binding Path="Name"...

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...

Which toolbox does facebook app use

windows,xaml
which toolbox is that? I use ListView now, but if I click it, it looks like I choose it, not click it. so I want to change....

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...

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>...

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....

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"...

Track information of current song in Universal App

c#,xaml,win-universal-app,universal,windows-media-player
I'm trying to get the track info (song, album, artist name) of the currently played media in an Windows Universal App. The information can be updated by using the SystemMediaTransportControls. Is it possible to read the information of a song played by another app (like XBox Music)?...

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"...

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...

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>...

xaml c# chart with custom axis label

c#,wpf,xaml,charts
I use System.Windows.Controls.DataVisualization.Charting to draw and show a chart with a LineSeries whose Y values are in a range between 1 to 5. I add values to LineSeries with System.Collections.Generic.KeyValuePair(TKey,TValue). Instead of showing numbers from 1 to 5 in the Y label chart, I want to show letters from E...

GridView with two columns Win Phone 8.1

xaml,windows-phone-8.1
I am currently learning Windows Phone 8.1 app development. I am going through this Channel 9 series of video tutorials. They are useful but unfortunately are for Windows Phone 8, not 8.1 and so there are some things I can't follow. I am stuck in such a situation. I want...

How to reference and use label in c# wpf

c#,wpf,xaml
I'm currently playing with wpf for the first time and I'm coming into some issues. I cannot figure out how to reference the wpf label element. I changed my label name to "label1" and try referencing it in my c# code, but alas no result just errors such as. xaml...

How to add a checkbox to the image in ListView?

c#,wpf,xaml
Please see the code below that adds images from local folder to a ListView: for (int i = 0; i < num_of_slides; i++) //populate the thumbnail list { var fileName = @dir + (i+1) + ".png"; var bitmap = new BitmapImage(new Uri(fileName)); Image image = new Image() { Source =...

how to show some value on button from value of some variable using XAML

wpf,xaml
Suppose I am having a variable who is getting some value on runtime ,I have some button on which I want to display that value from the variable using WPF/XAML.How will I be able to bind the content displayed over the button with the value of the variable. Suppose button...

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}"...

Bind control property from the inner control

c#,wpf,xaml,templates,winrt-xaml
I have a control that contains another control. InnerControl contains some property like ButtonVisibility. The simplified InnerControl code sample is below public class InnerControl : ControlBase { //... public Visibility ButtonVisibility { get { return (Visibility)GetValue(ButtonVisibility); } set { SetValue(ButtonVisibility, value); } } public static readonly DependencyProperty ButtonVisibility = DependencyProperty.Register(...

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...

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...

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...

WinPhone 8.1 | Force xaml layout change

c#,xaml,windows-phone-8.1,win-universal-app
I have a textbox that when the user presses enter, we perform an API call. However during this time I want to update the XAML layout to show a progressbar. However the layout update only takes place after the method has completed meaning that no progress bar is visible while...

Xaml Browser Application opens as a download file on client machine

c#,wpf,xaml,browser,xbap
I have a Xaml browser application that I deployed on my computer. It seems to run fine and open on my computer in Internet Explorer. When I try to access it from client computer on the same network, it opens the application as a download file on Internet Explorer. I...

Progressbar for filling TextBox using MVVM Light Toolkit in WinRT

c#,wpf,xaml,mvvm,windows-runtime
I have a form containing few TextBox elements and a progress bar. I want the progress bar to be updated when the TextBox's have some values assigned. So when a value is set to a TextBox I increment ProgressPercent if the lenght is different from 0; The problem is that...

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}" />...

Create a property out of a Class

c#,wpf,xaml
I have created a class, which shortens a text to fit into a textbox, while also adding "...". Example: [ThisTextis]toolong > [ThisTex...] I'm using Microsoft Visual Studio 2013 on a Windows 8.1 VM (Virtual Machine) and the software is an App. Now it might not be perfect, but that works...

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...

How to set TextBox to be resized when DataGridTemplateColumn size changes

c#,wpf,xaml
I tried some stuff but all didn't work. Maybe I missed something. The goal is to have to fill horizontally column with TextEdit and have it autoresized when user change column size by dragging. <DataGrid> <DataGrid.Columns> <DataGridTemplateColumn Width="200"> <DataGridTemplateColumn.HeaderTemplate> <DataTemplate> <TextBox/> </DataTemplate> </DataGridTemplateColumn.HeaderTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> ...

Back button closing app instead of going back on Windows Phone 8.1

vb.net,xaml,windows-phone-8.1
I've created a simple Windows Phone 8.1 app in Visual Studio 2013 and added 2 Basic Pages, along with some code to navigate to the second screen when a button on the first screen is clicked. Going to the second screen works fine, but when the hardware Back button is...

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:...

ScrollViewer ChangeView on SizeChanged

c#,wpf,xaml,windows-phone-8.1
I have DataTemplate which I use in HubSection: <DataTemplate x:Name="dataTemplate2"> <Grid x:Name="greedy"> <ScrollViewer x:Name="scroller" SizeChanged="ScrollViewer_SizeChanged" Height="{Binding Height,ElementName=greedy}" > <ItemsControl x:Name="itemsControl" ItemsSource="{Binding}" ItemTemplate="{StaticResource dataTemplateDetails}"> <ItemsControl.ItemContainerTransitions> <TransitionCollection> <ReorderThemeTransition /> <NavigationThemeTransition />...

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...

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),...

Change GroupBox Header location

c#,.net,wpf,xaml
I have the following GroupBox whose text sits on the border of the control. Currently, half of the text is inside and half is outside the control. How can I move it to sit completely inside the control? <GroupBox Grid.Row="2" Background="LightSteelBlue"> <GroupBox.Header> <Label FontSize="15" VerticalAlignment="Bottom" FontFamily="Calibri" FontWeight="ExtraBold">Traceability Data</Label> </GroupBox.Header> </GroupBox>...

Wrap text with indent in WPF textBlock

wpf,xaml,wrap,textblock
I am using a listbox to display undo redo list with data template as: <ListBox x:Name="actionList" Height="150" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" MouseMove="ListBoxMouseMove" ScrollViewer.VerticalScrollBarVisibility="Visible" SelectionMode="Extended" Style="{StaticResource CustomListBoxStyle}"> <ListBox.ItemTemplate> <DataTemplate> <TextBlock Width="235" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" FontSize="11" Text="{Binding DisplayText}" TextWrapping="Wrap" />...

DataBinding Issue while using MultiDataTrigger

c#,wpf,xaml
Its looks simple and i tried all possible ways i know to fix the error still no luck, looks like am missing something. Here is my code. at least the relevent part <ItemsControl ItemsSource="{Binding Source}" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <Grid/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <VirtualizingStackPanel Orientation="Horizontal"> <ContentControl> <Path x:Name="Bound" Stroke="Black"> <Path.Style>...

Visual Studio 2013 crashes when writing opening angle bracket

visual-studio,xaml,crash,intellisense,xamarin.forms
everytime I try to write an opening angle bracket in vs13 it crashes. The Problem only happens in a xamarin.forms project and in an xaml-file. Every other key works fine, just the opening angle bracket causes the problem. If I copy/paste it in the code it works fine, as well......

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 ///...

WinRT control to render XAML UIElement

c#,xaml,windows-runtime,winrt-xaml
I am porting a WPF app into WinRT. The old app had a part where it would take something like an Image, MediaElement, a Xaml Page, etc; cast it as a UIElement; and then the recieving class would use VisualBrush to render it onto a button. Unfortunately WinRT has no...

DataGridRowTemplateColumn - refactoring and using styles efficiently?

c#,wpf,xaml,datagrid
I currently have a big lump of XAML that I am struggling to refactor. <DataGrid x:Name="CurrentConfigDataGrid" ItemsSource="{Binding}" > <DataGrid.Resources> <ResourceDictionary Source="../ResourceDictionaries/MergedDictionary.xaml" /> </DataGrid.Resources> <DataGrid.ItemContainerStyle> <Style TargetType="{x:Type DataGridRow}" BasedOn="{StaticResource {x:Type DataGridRow}}" /> </DataGrid.ItemContainerStyle> <DataGrid.Columns> <DataGridCheckBoxColumn Width="25">...

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...

Update bindings from other bindings using MVVM in WPF

c#,wpf,xaml,mvvm,binding
Does anyone have any suggestions of how to fix my problem?? I have a datagrid binded to a collection of ModelCheckoutRecord objects (ListModelCheckoutRecords). I am binding the selected item to a ModelCheckoutRecord (SelectedItemModelCheckoutRecord). In the binding for the selected item I want to update the visibility binding for another datagrid...

WPF Custom Control VB.net

wpf,vb.net,xaml,custom-controls
I've created a custom control called ecTextBox in VB.NET which uses a control template in Generic.xaml. That works. In code behind of the custom control I override metadata in the constructor: Public Sub New() DefaultStyleKeyProperty.OverrideMetadata(GetType(ecTextBox), New FrameworkPropertyMetadata(GetType(ecTextBox))) End Sub In MainWindow.xaml I use the custom control with a simple <ec:ecTextBox/>...

Animate ScaleTransform of a Button using VisualStateManager

xaml,animation,windows-phone-8,visualstatemanager
I created a control template for a button which contains a grid and a content control. What I want to do is the following: when the button is pressed, the scale of the button should animate to 0.5 and when the button leaves the pressed state, the button's scale should...

How to change MahApps.Metro dialog content template width?

wpf,xaml,modal-dialog,controltemplate,mahapps.metro
I would like to change the base template of the MahApps.Metro dialogs (or create a new dialog type), because I would like to show them in a narrow login window. Right now almost all the second words in the message are in a new row, but there are nice big...

WPF | VB .Net || Textbox Placeholder

wpf,vb.net,xaml,textbox,placeholder
i want to have a placeholder in my textbox in wpf.. i tried to search xaml script to solve my problem, and i find that xaml codes are too long for simple placeholder, then i end up with my own solution.. is event handlers will slow down an app? Dim...

Looping “complex” object with ItemsControl

wpf,xaml,itemscontrol
I have the following "element": public class ReportElementViewModel { public string Name { get { return _name; } set { if (_name != value) { _name = value; RaisePropertyChanged("Name"); } } } public bool IsChecked { get { return _isChecked; } set { if (_isChecked != value) { _isChecked =...

Take element's parent name, a few levels above

c#,wpf,xaml
I have many TabItems in my MainWindow.xaml.cs They are all with the same structures. This is one of them. <TabItem Name="tabFeatured" Header="Featured" DataContext="{Binding TemplatesFeatured}"> <ScrollViewer> <ItemsControl Name="ItemsControlFeatured" ItemsSource="{Binding}" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel/> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Button Name="Featured" Tag="{Binding Id}"...

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...

How to properly position elements in a stack panel?

c#,wpf,xaml,data-binding
Let's say, I have a class that looks like this: public class Item { public string Name { get; set; } public List<Item> SubItems { get; set; } } I want to display a list of such items in such a way that top-level items are arranged horizontally, and their...

GridViewColumn.Width binding and double-click to autosize column

c#,wpf,xaml,binding
Binding column width like this <ListView ...> <ListView.View> <GridView> <GridViewColumn Width="{Binding Width, Mode=TwoWay}" ... /> ... more columns </GridView> </ListView.View> </ListView> The problem: when double clicking column header line (to autosize column) no Width setter is triggered, which means binding source is not updated after such column width changing. Normal...

Unable to bind to DataContext

c#,wpf,xaml,data-binding
I am having a really weird problem. I am trying to bind a property to the DataContext but it is not working. This is what I am doing (in the Window.Resources section): <myNS:MyClass x:Key="myObj" MyProp="{Binding}"/> Elsewhere in the code, I set the data context like this: myWindow.DataContext = MyNameSpace.MySingleton.Instance; I...

RadioButtons binding on Windows Phone 8.1

c#,xaml,mvvm,radio-button,windows-phone-8.1
I have some problem with binding my RadioButton property IsChecked. I have two RadioButton's on the grid, which Visibility binded to a property on my viewmodel. What i want to achieve is to always setting first RadioButton to Checked state, when grid is become visible. Here is some code: <Grid...