I have a lot of XAML code and would like to stay compatible with WPF 3.0 while taking advantage of the WPF 4.0 features. For example, I'd like to use UseLayoutRounding if it's available. Of course, I could do this in C#:
void SetProperty(..)
{
#if WPF4
set property
#endif
}
Is there an elegant way to accomplish the same thing in XAML...
In the following XAML, the word "Test" centers horizontally but not vertically.
How can I get it to center vertically?
<Window x:Class="TestVerticalAlign2343.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterSc...
Hi!
I have something like orders table binded to datagrid.
I want to disable editing on rows, where order date is expired (deadline date > current date): show them greyed and ban entering into edit mode.
here what I have
<Style TargetType="{x:Type WPFToolkit:DataGridRow}">
<Style.Triggers>
<MultiTrigger>
<MultiTrigger....
Here's the scenario. We use a large XML configuration file for one of our server products. This file is fairly well layed out and is validated against an XSD file.
It's time now though to build a configuration GUI for maintaining this file and I would like to dive into WPF to do it. I could lay out a seperate form for each config sectio...
I have this XmlElement, and add some attributes to it:
xmlElemMux.SetAttribute("test1", "1");
xmlElemMux.SetAttribute("test2", "0");
I can display those in a window using a textbox like this in the xaml, after setting the DataContext of my grid to xmlElemMux:
TextBox Text="{Binding XPath=@test1}"
TextBox Text="{Binding XPath=@test2}"
T...
I have a silverlight class library (not a top-level application) with several user controls that are shared by different silverlight applications. I have gone through and pulled out several styles and brushes for the controls and put them in a separate XAML file as a resource dictionary which I bring into each control as a merged resourc...
The question is how to implement INotifyPropertyChanged on a static property because the event you implement is not static, and cannot be called by a static property. Also, you cannot bind to a static property in silverlight.
I've seen this question pop up an a few forums with a variety of solutions, none of which were very satisfying.
...
I'm using an ExpressionMediaPlayer to play live streams. Obviously for this I don't need a play/pause button.
Is there already a predefined way to select which controls to show, or is the correct way to edit the control template and just remove them? Trying to keep everything as out of the box as possible...
...
Just wondering what people had for ideas on how best to handle events in a ViewModel from controls on a View ... in the most lightweight way possible.
Example:
<MediaElement
MediaOpened={Binding SomeEventHandler} />
In this case we want to handle the MediaOpened event in a ViewModel. Without a framework like Prism, how would on...
I know I can get the size of the primary screen by using
System.Windows.SystemParameters.PrimaryScreenWidth;
System.Windows.SystemParameters.PrimaryScreenHeight;
But how do I get the size of the current screen ?
(Multi-Screen users do not always use the primary screen and not all screens are using the same resolution, right ?)
Nice wo...
I could use FrameworkElementFactory to create a template, but this class is deprecated. The recommended way, according to MSDN is to use XamlReader.Load to load XAML from a string or a memory stream. I get this to work, but think this is kind of sad:
string xaml = "a lot of XAML";
Any suggestions to be able to do this in a better way?...
I recently added a control library project to my Silverlight app's solution, so the solution now has three projects:
SLClient
SLClient.Controls
SLClient.Web
SLClient has a project reference to SLClient.Controls, which contains the following:
Themes
Generic.xaml (contains default CustomTextBox template)
Templates.xaml (contains add...
I have two tables in a database and using entity framework and ria services to display data in a simple datagrid. Here is the database/EF structure
Cars Make
----- ----
CarId MakeId
Car Make
MakeId
In my Silverlight datagrid I want to show the following two columns, for example
Car Make
--- -----
Escort ...
My understanding of x:Name vs Name is that some controls have a Name property, that is basically the same as setting x:Name.
Is there an advantage to using Name when it is available over x:Name?
Here's my reference for understanding x:Name vs Name.
...
After a couple hours of Googling I haven't been able to find any comments on this issue. We have a WindowStyle=None window with transparent background and allows transparency and does not show in taskbar, all pretty normal. Here's the XAML so you can test for yourself:
<Window x:Class="AltTabTest.Window1"
xmlns="http://schemas.microsoft...
I am looking into creating type-safe generic controls. This is targeting the (reduced) generics support in WPF 4 and future Silverlight, and will include a hierarchy of generic controls.
I have two questions:
Can you use style setters and template bindings for non-generic properties defined on a generic control?
In Silverlight, is the...
Wpf 4.0 is a buzzword these days which is the latest version of Wpf, I want to know what is the current version of xaml? and what was the previous version of xaml as well as Wpf?
...
I want to simulate a Button IsPressed event for a ComboBoxItem. Is this possible strictly in xaml? I know how to in code-behind as well as changing the Style or Template but I was hoping to accomplish this in xaml with a Standard ComboBoxItem. TIA
...
Given a populated ListView how do I iterate through each bound 'template' and pluck out the contained ComboBox (or any other control contained in 'DataTemplate')?
<ListView x:Name="lstCommands">
<ListView.ItemTemplate>
<DataTemplate>
<Grid x:Name="gridInputs">
<Grid.ColumnDefinitions>
<ColumnDefin...