xaml

Why are tab headers displayed in the content area of tabs in a XAML TabControl?

I've got a TabControl whose ItemsSource is bound to an observable collection of views (UserControls) each which have as its root element a TabItem. However, when it is displayed, the Header text is in content of each TabItem, as if UserControl wrapper is causing conflicts: The TabControl is in SmartFormView.xaml: <UserControl x:Class...

Why is my TabItem custom control not showing up in the TabControl

I made a custom control called SmartTabItem, currently just the default implementation: using System.Windows; using System.Windows.Controls; namespace TestControl.Controls { public class SmartTabItem : TabItem { static SmartTabItem() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SmartTabItem), ne...

Binding to a property defined by binding on another property

I've got a problem which has been tormenting me for the last couple of days. I have a grid (Infragistics) to which I've applied a CellPresenterStyle which will change the contents of the cell to a ToggleButton if The cell is in the currently selected row, and The databound field is contained in a collection in my ViewModel The last p...

How can I make a specific TabItem gain focus on a TabControl without click event?

How can I tell my TabControl to set the focus to its first TabItem, something like this: PSEUDO-CODE: ((TabItem)(MainTabControl.Children[0])).SetFocus(); ...

WPF MenuItem Delimiter

What is the simplest way to put a little delimiter/line between 2 menu items in WPF? ...

Why don't the items in my ItemsControls layout horizontally?

I want to have an ItemsControl in which the items are displayed horizontally. However, no matter if I use StackPanel with Orientation="Horizontal" or WrapPanel, they still stack up. How can I get items in an ItemsControl to be horizontally? XAML: <Window x:Class="TestItemsControl2938.Window1" xmlns="http://schemas.microsoft.com...

What is so special about Generic.xaml?

I've been trying to figure out how to organize my ResourceDictionary files for reuse and sharing with other members of my team. I keep coming across "Generic.xaml", but if I look on MSDN for Generic.xaml or just do a Google search, I only seem to get blog posts and forum questions that happen to mention it--I can't seem to hit upon anyt...

XamlParseException - Invalid attribute value (...) for property Property

I'm having some trouble styling a custom control that I built. Here's the control source: namespace SilverlightStyleTest { public class AnotherControl: TextBox { public string MyProperty { get; set; } } } In the same namespace & project I try to create a style with a setter for MyProperty like so: <UserControl x:...

Trouble referencing a Resource Dictionary that contains a Merged Dictionary

I have a library, CommonLibraryWpfThemes, with several Resource Dictionary XAML files in it. My Themes/Generic.xml file contains a ResourceDictionary.MergedDictionaries declaration that merges all the other files together. Generic.xaml <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x...

design time usercontrols - I can't see anything!

newbie question, please forgive... I'm developing a Wpf UserControl that will eventually be bound to a business object. The usercontrol is little more than a series of laid out TextBlocks, and perhaps (later) an image or two. As I'm laying out the usercontrol, I can put dummy text into all the TextBlocks so I can see what the usercon...

In WPF how do you access an object defined in Window.xaml from a nested user control ?

I have a situation where I need to access an object that has been defined in one user control from within a user control nested 2 levels deep. Take the following for example: public class MyClass { public MyClass() { MyData = new MyDataProvider(); } public MyDataProvider MyData; public string SelectedValue;...

Is there an easy way to make a code TextBox?

Is there an easy way to make a code TextBox? I'm trying to make my own limited/specialized version of XAMLPad. Displaying the current XAML object tree in the top display is simple enough, using XamlReader.Parse() ... But I'd like the actual XAML code in the bottom window to show up in its appropriate colors. Here is an example o...

xbap gracefully handle lack of permissions

I have an Xbap application that is part of an intranet application that needs file system access. Ive made the app full trust, signed it with a valid certificate and imported the cert into ie and the xbap works perfectly. My issue is that I want to gracefully handle a Permission Denied exception if the user doen't have the certificate ...

How to detect the current theme in WPF's Xaml?

I have a custom control that needs a minor adjustment when running on XP or Vista with the Aero theme, is there a simple way to detect the theme (operating system detection isn't enough because the user can change the theme) and use this in a style trigger? I need to apply a small margin change on Vista to get the look required: ...

How does my View know about its Presenter without DataContext?

In XAML, I'm displaying all my presenters as tab items: <TabControl.ContentTemplate> <DataTemplate DataType="x:Type views:SmartFormAreaPresenter"> <views:SmartFormAreaView/> </DataTemplate> </TabControl.ContentTemplate> I've noticed that each View has access to its respective Presenter's properties even without me ever...

Why are there thin hairlines (1 pixel?) between ItemsControl items?

When I have background colors on the items in an ItemsControl, and set the margins to 0, WPF leaves hairlines between the items as if the ItemsControl wrapper plumbing is taking up a minute amount of space. I checked the visual tree with Snoop and all margins are set to 0,0,0,0. What are causing these lines and how can I avoid them? ...

XAML page Flip twist

I have this Page.xaml <UserControl x:Class="SLBookDemoApp.Page" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:SLMitsuControls;assembly=SLMitsuControls" Width="800" Height="600" Loaded="UserControl_Loaded"> <Grid> <local:UCBook...

XpsDocumentWriter.WriteAsync not working

I am trying to use XpsDocumentWriter.WriteAsync to write to a printer. Write works perfectly but as soon as i use WriteAsync nothing happens. Do i need to do anything special to use WriteAsync ? ...

Is xaml in WPF equivalent of .Designer.cs in Windows Forms apps?

Is xaml in WPF equivalent of .Designer.cs in Windows Forms apps? Does it just provide compile-time state for the UI? I am not sure but it looks like you can do things programmatically with xaml at run-time. If I have a basic UI state where everything is added at run-time, then should I be looking outside the xaml stuff? ...

Removing event handlers in xaml style?

Hi, Is there a way to remove event handlers in a style that were defined in another style? Here's a contrived example: <Style TargetType="{x:Type TextBox}" x:Key="DefaultTextBoxStyle"> <EventSetter Event="GotFocus" Handler="TextBox_GotFocus"/> <EventSetter Event="LostFocus" Handler="TextBox_LostFocus"/> <EventSetter Event...