All Questions
78
questions
20
votes
3
answers
10k
views
WPF WindowChrome: Edges of maximized Window are out of the screen
I use WindowChrome to customize a Window. When I maximize the Window, then the edges are out of the screen. I use the following code to fix this:
<Window x:Class="WpfApplication1.MainWindow"
...
19
votes
1
answer
52k
views
Programmatically add control to Grid RowDefition in WPF 4.5
I've been through this site (and many others) trying to figure out what is going on and why this does not work. I am running VS2012 and have created a WPF C# app (target .NET 4.5). I am new to WPF, ...
16
votes
5
answers
11k
views
Why does TextBlock trims ending spaces from the text?
Here are my TextBlocks:
<StackPanel Orientation="Horizontal" Margin="0,3,0,0">
<TextBlock Text="6 or more characters, at least one letter and a number, " ...
11
votes
4
answers
5k
views
Overriding ListBoxItem background color when not in focus (.NET 4.5)
According to this, overriding the ControlBrushKey resource should change the background color of a ListBox selected item when it doesn't have focus. I created a simple example to disprove this:
<...
10
votes
4
answers
29k
views
Styling a WPF Button with Image+Text
In my C#/WPF/.NET 4.5 application I have buttons with images that I implemented in the following fashion:
<Button Style="{StaticResource BigButton}">
<StackPanel>
<Image Source="...
8
votes
2
answers
2k
views
Taskbar icon disappears when WindowChrome is used on Windows 8.1
I have some problems with an own styled WPF Window on Windows 8.1. I wrote a simple transparent WPF Window with a WindowChrome for default windows drag behaviors:
<Window x:Class="WpfApplication1....
7
votes
5
answers
3k
views
Where in Windows 8 app should you code 'privacy policy'?
my app failed certification with reason : "4.1.1 Your app must have a privacy statement if it is network-capable
. . .
You must provide access to your privacy policy in the Description page of your ...
6
votes
2
answers
3k
views
Where is the "ListViewItemPlaceholderBackgroundThemeBrush" located?
I have a problem understanding one style definition in Windows 8 metro apps.
When you create a metro style application with VS, there is also a folder named
Common
created. Inside this folder ...
5
votes
3
answers
3k
views
How to change the selected text color in a TextBlock in a ListView?
I am building a Windows 8 store application and I can't manage to change the highlighted/selected color a of TextBlock in a ListView.
Here's how I create my ListView :
<ListView x:Name="...
4
votes
1
answer
298
views
How can I define primitives in StandardStyles.xaml
I want to define double values so that I can reuse it in many UIElements
<Double x:Key="MyWidth">100</Double>
<String x:Key="MyString">This is my text</String>
It's giving me ...
4
votes
3
answers
5k
views
WPF Visibility Resource with Binding
I got a WPF Application using MVVM Light. In one View i got many Controls which are using the same visibility binding. Because i dont like to insert my long binding path to every control. I'd like to ...
4
votes
1
answer
91
views
Rude tab keeps coming to the front
I have a TabControl that uses the following XAML.
<TabControl x:Class="MyApp.Tab.TabContainer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://...
3
votes
3
answers
982
views
Using static function binding in XAML
I have a XAML file, where i want to replace field names with variables so i can have translation support for more languages for my application.
The way i currently use translation in my application ...
3
votes
1
answer
2k
views
Stretch WrapPanel items
I have WrapPanel and very similar items within it. Maybe WrapPanel is a wrong container, just describing what I have.
I want all items have equal width; minimum width of 120. Also, I want items to ...
3
votes
1
answer
406
views
Why is my Named WPF Shape Inaccesible from Code Behind?
I have an Ellipse in my WPF application. I want to change the colour of its outline whenever it is double clicked. I found this (old) tutorial about making this work by using the available MouseDown ...
3
votes
1
answer
2k
views
Create a generic list in xaml 4.5+
I am trying to make a rule list for one of my usercontrols. List contains a custom type List<StringInputRule>. I am using DependancyProperty to databind.
I am trying to set the rules in xaml ...
3
votes
1
answer
394
views
WPF style in Application resources
I have a style in application resources which I want to apply to many different pie charts. The style looks like this:
<Style x:Key="aaa" TargetType="{x:Type nm:CustomChartControl}">
<...
3
votes
0
answers
402
views
event handler does not work for inherited control
I have a class that inherits from ComboBox. If I use the standard ComboBox class in my control the following event handler works fine:
private void SelectionChanged(object sender, RoutedEventArgs e)
...
3
votes
0
answers
397
views
Stylecop or equivalent tool for XAML .Net 4.5
I want to use StyleCop or any other equivalent tool for XAML. So that I can make my code readable.
How can I do this with any tool?
Please help.
3
votes
2
answers
1k
views
Databinding a WPF grid control to a CSV file
Is something like this possible?
I'm currently trying to read a CSV file directly into a WPF DataGrid. The file doesn't have a known format - that is, I don't know what the field are, or how many ...
2
votes
1
answer
3k
views
wpf datagrid rowdetail is cut off
I have a WPF datagrid that changes the rowdetails datatemplate based on the combobox selection of one of the columns(action column). One of the rowdetails template is large and the space provided for ...
2
votes
2
answers
4k
views
Windows 8 Button click programmatically in C# and Xaml
I want to click button programatically in C# xaml. As I found that there is no method like PerformClick. What else is the alternative for it.
Actually I have set of 10 buttons with x:Name like btn1, ...
2
votes
2
answers
2k
views
Get name of GeometryModel3D
The FrameworkElement.FindName(string name) method returns an object from the XAML namescope. As a reverse to this, is there a way to get the name of the object as a string by passing the object?
...
2
votes
1
answer
2k
views
WPF GridSplitter sizing with MinWidth
I'm trying to make a very simple two-column window, in which the right column starts at width 150, with a minimum width of 150, the left column fills the remaining space, with a minimum width of 300, ...
2
votes
1
answer
479
views
In pure XAML, is it possible to select a string format on the fly?
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 ...
2
votes
1
answer
484
views
How to use Interaction Triggers for maximizing and minimizing WPF window using c# with mvvm pattern?
I can close a window using Interaction Triggers like
<Button Content="X" Height="20" Width="20">
<i:Interaction.Triggers>
...
2
votes
0
answers
170
views
Resolve relative pack URI in .NET 4.5
I want to compare two URI's that point to pages in my application. Unfortunately, JournalEntry pages from a Frame or Navigation window have a relative URI, but it does not match the URI syntax I use ...
2
votes
0
answers
457
views
.NET 4.5 Databinding to Singleton using ObjectDataProvider (used to work in .NET 4.0)
First, I have to say that all this already worked flawlessly on .NET 4.0!
Now switching to .NET 4.5 (or even .NET 4.0 with installed .NET 4.5), at ListBox.DataContext I get an XamlParseException....
2
votes
0
answers
196
views
Exception: "Cannot locate resource 'FilePath.xaml'" when path contains square brackets and using dot net 4.5
We have a C# application with some screens written in WPF. I am trying to migrate it to dot net framework 4.5 (I need to use one of it's features). But when I run my application I am getting an ...
1
vote
4
answers
10k
views
Data Binding an observable collection of strings
I have the following class:
public class MyClass
{
public ObservableCollection<string> MyList { get; set; }
public string MyListTitle { get; set; }
...
I'm populating it as follows:
...
1
vote
4
answers
5k
views
A Simple Photo Album with Pinch and Zoom using FlipView
I'm trying to create a simple photo album (Windows Store App) using Flip View.
I have the Image element embedded within a ScrollViewer. I'm able to browse through the photos, but I'm looking to do ...
1
vote
1
answer
1k
views
how to prevent going back to previous page
For a windows phone 8 app I'm developing, I had to load some data at the starting of the app. For that matter I designed a page called SplashScreen.xaml that loads the data and after all the loading ...
1
vote
2
answers
447
views
Crop content of rounded-corner border with image out of border
I need to move and rotate the image outside of the rounded border
example:
In How to make the contents of a round-cornered border be also round-cornered? find answer:
<Grid>
<Grid....
1
vote
1
answer
2k
views
WPF Grid.IsSharedSizeScope between two parent controls?
I have a situation where I need to share the width of a column between grids in two group boxes, the XAML looks something like this:
<GroupBox Header="Box A">
<StackPanel Orientation=...
1
vote
1
answer
176
views
DrawingImage is getting fuzzy and image gets bigger and cut-off when Windows scaling is set to more than 100%, for example 125%
I have an WPF usercontrol which is used in a winforms applications. WPF usercontrol is contained within an ElementHost container.
This WPF usercontrol has some images, button with images, labels, etc.
...
1
vote
1
answer
3k
views
WPF/MVVM : How to bind model to view/viewmodel from ItemsControl
I have an ItemsControl bound to a list of Tasks. And I would like to give that model Task to its view TaskView and viewmodel TaskViewModel.
I have try to bind values on the view property like that :
...
1
vote
1
answer
367
views
Databinding - Lozalized FallbackValue/TargetNullValue etc
In my Windows Phone 8 C#/XAML .NET 4.5 App I'm using databinding from ViewModel, which is working fine.
What I'd like is for a lozalized string from LocalizedResources to be displayed as a content of ...
1
vote
1
answer
2k
views
Loading XAML to C# for Data Binding
Ok, we are trying out XAML for our GUI now (and learning as we go)...I have been able to do the data binding without a problem in XAML and C# independent of one another, but now comes the time I need ...
1
vote
1
answer
875
views
Using Path Animation in Windows 8 using XAML
I would like to animate a UI control (an Image actually) over a Path provided.
It is looking that it is not possible to do it in Windows 8 using XAML although it was possible with .NET 4.5 as far as ...
1
vote
1
answer
2k
views
Range slider metro style app
I'm trying to make a range slider for metro style app, because it's not available. I'm trying to leverage an existing silverlight range slider, but it's not going to well. I changed the code a bit, ...
1
vote
1
answer
83
views
Extra whitespace area at the bottom side of a Popup, it does not resize correctly to fit its content height
In a User Control I have below content:
<Grid>
<Popup x:Name="myPopup"
AllowsTransparency="True"
StaysOpen="False"
...
1
vote
1
answer
389
views
Cannot Get MVVM Light EventToCommand to Work
I am having trouble getting MVVM Light EventToCommand to work. I currently have these packages:
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net452" />
...
1
vote
1
answer
1k
views
Setting MaxWidth at runtime in WPF
This is a .Net 4.5 WPF question.
I am trying to set the MaxWidth of a FrameworkElement defined in XAML (specifically, an Expander) programmatically, but I've tried
myFrameworkElement.MaxWidth = ...
1
vote
0
answers
98
views
How to localize page title using resource files (.resw)?
I need to translate the title of basic page in windows8 app. Here is a xaml string:
<Page.Resources>
<!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
&...
0
votes
1
answer
2k
views
Change the disabled color of a button in XAML Windows 8
I want to be able to change the background color of a button in XAML when it's disabled but I don't know what to override.
Anybody know what I need to do?
I'm create a Windows 8 store app using XAML ...
0
votes
1
answer
3k
views
how to use MenuItem in another MenuItem in wpf
I want to make a menu like this in wpf
I wrote this code:
<MenuItem Header="Menu 4" MouseEnter="mousecom" Background="DarkGreen">
<MenuItem.ContextMenu>
<...
0
votes
1
answer
533
views
RibbonToolTip is inheriting alignment from a textbox
I'm having an issue with RibbonToolTips inheriting alignment from a textbox in the ribbon. The problem is that I can't seem to override this behavior no matter what I do. This only seems to manifest ...
0
votes
1
answer
2k
views
ComboBox data filtering in xaml
I am using a Telerik combobox but I think the question is relevant to the standard wpf combobox. The control is bound to an observable collection of “TableRecord” where this object looks like this:
...
0
votes
1
answer
55
views
Viewbox interfering grid columns horizontal alignment
I am using a Viewbox with Stretch set to Uniform in order to not distort the content when user switches between screen resolutions and scale in the OS.
Within the Viewbox I have a grid.
The grid has ...
0
votes
1
answer
1k
views
Defining a Path in a User Control throws compilation error: XDG0012 The member "Loaded" is not recognized or not accessible
I had a dictionary.xaml where I defined the path specified here but I was having compilation error (see error below).
As I want to reuse it in other places, @Clemens suggested me to put it in an WPF ...