I'm binding a collection of my W3CErrorOrWarning type objects to controls in a WPF Window.
One of its properties is named "Type". It is of type W3CErrorOrWarningType which is a simple Enum:
Enum W3CErrorOrWarningType
ValidationError
ValidationWarning
End Enum
I'm trying to use it in this way...
<Window ...
xmlns:en...
I was trying to bind a collection of my W3CError type objects to a WPF ListView control.
It was a nice little 13 line class...
Class W3CError
Public Type As ErrorOrWarning
Public Line As Integer
Public Col As Integer
Public Message As String
Public MessageId As String
Public Explanation As String
Public So...
I want to set the background property of all the usercontrols of my project.
I tried with
<style TargetType={x:Type UserControl}>
<setter property="Background" Value="Red" />
</style>
It compiles but didn't work.
¿Any Idea?
Thanks!
...
Using WPF, what is the most efficient way to measure a large number of short strings? Specifically, I'd like to determine the display height of each string, given uniform formatting (same font, size, weight, etc.) and the maximum width the string may occupy?
...
In WPF, is there an easy way to add wavy underlines (like spelling errors in Word) to FlowDocument elements? There's the Underline class, but there seems to be no way to style it.
...
WPF is positioned as a successor to WinForms, but given Microsoft's practice of abandoning toolkits (and what I perceive a s"bloat" in WPF), are there any recommended alternatives?
...
I want to be able to hide the header at the top of each grid column in a WPF ListView.
This is the XAML for my ListView:
<Window x:Class="ListViewTest.Test0.ListViewTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Empty ListView Grid" Heigh...
With reference to this programming game I am currently building.
I have a Class Library (dll) that will have a method Run which will be composed of something like such:
public class MyRobot : Robot
{
public void Run(}
{
while (true)
{
Ahead(200); //moves the bot 200pixels
TurnLeft(90); /...
I have a listbox with a bunch of contols in each list item.
<ListBox x:Name="projectList" IsSynchronizedWithCurrentItem="True">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Name}" />
<ListBox x:Name="taskList" ItemsSource="{Binding Tasks}">
...
In WPF App.Current.SessionEnding must return in a few seconds, otherwise the "application does not respond" window appears. So the user can't be asked in this event handler to save his data, because the user's response takes longer than a few seconds.
I thought a solution would be to cancel the logoff / shutdown / restart, and resume it...
I need to be able to set up a background hotkey event for a WPF application. (by background I mean that the application in question might not necessary be in focus).
I know that with WinForms the proper way of doing it would be to import user32.dll, and use RegisterHotKey, and the catch the appropriate WM_POST message. I'm convinced t...
I recently started working with Silverlight and immediately noticed the difference between the Silverlight BCL and the full .Net and WPF. For some of them I've found great solutions posted online by other developers, and others were more complicated. What features/classes were you surprised/disappointed to find absent from the Silverli...
I have a user control which contains a textbox. I have a class called Person which implements IDataErrorInfo interface:
class Person : IDataErrorInfo
{
private bool hasErrors = false;
#region IDataErrorInfo Members
public string Error
{
get
{
string error = null;
...
I'm looking for some arguments to pitch to my boss and fellow developers.
We're currently finishing up the preliminary UI mockups and getting ready to move on to the next phases of development. In the meantime, I've been digging through the depths of the Carbon, Win32, and wxWidgets APIs attempting to make some of the controls have a...
Using the MVVM-pattern you set the DataContext to a specific ViewModel. Now is there any way to tell the XAML the type of the DataContext so that it will validate my bindings?
Looking for something like the typed viewdata in ASP.NET MVC.
...
I want to create wavy underlines using TextDecoration (in a control similar to RichTextBox).
I did the following thing:
private static Pen CreateErrorPen() {
var geometry = new StreamGeometry();
using (var context = geometry.Open()) {
context.BeginFigure(new Point(0.0, 0.0), false, false);
context.PolyLineTo(new...
I'm trying to implement a button in WPF which shows a menu when you click it. I've got everything working, and the ControlTemplate for the control is shown below. (The control extends ToggleButton).
<Border x:Name="Border" Padding="3" CornerRadius="1" BorderThickness="1"
VerticalAlignment="Stretch" HorizontalAlignment="Stretch" IsHi...
It's easy for a WPF application to make parts of a window transparent or semi-transparent. But how to I apply the current Vista theme (colors, opacity) to these transparent parts?
When I have a green glass border how will I get a green glass background of the same style?
Is it even possible to do this without calls to the Windows API?
...
I have an application that displays league tables for sporting leagues. These tables are basically grids with different columns representing statistics for each team such as matches played, won, lost, goals scored and concieved etc. As such, a league table has one interesting property: For a given competition, we always have the same amo...
Is there a way to redefine/alias an existing SolidColorBrush (or any other resource, actually)?
Case in point: I have a brush in an external ResourceDictionary that I want to reference by my own key instead of the original key. I don't want to be dependent on the external reference, since the actual brush is prone to change in the futur...