xaml

wpf: design time error while writing Nested type in xaml

I have created a usercontrol which accept type of enum and assign the values of that enum to a ComboBox control in that usercontrol. Very Simple. I am using this user control in DataTemplates. Problem comes when there comes nested type. I assign that using this notation EnumType="{x:Type myNamespace:ParentType + NestedType}" It wor...

What is the easiest way to build a FrameworkElement that has bold and italic markup text?

Is there any more elegant way to do the following? Basically I need an easy way to programatically build a WrapPanel (or other FrameworkElement) that: wraps correctly allows some words to have bold text allows some words to have italic text allows other formatting, e.g. color, background ideal would be some method that converts e.g. "...

xaml browser application xbap

Hi, Has anyone worked on the xaml browser(xbap) application? how is it different from a typical asp .net web application and in what scenarios we can it can be used? ...

WPF XAML - Could not create an instance of type 'GlyphTypeface'. at design time.

I'm trying to visualize a XAML resource file at design time. When I merge the dictionary for the following XAML resource file into a XAML Window I get the error: Could not create an instance of type 'GlyphTypeface'. The problem line is: <GlyphTypeface FontUri="C:\WINDOWS\Fonts\TAHOMA.TTF" /> I have verified that the font exist in the...

Setting up binding to a custom DependencyProperty inside a WPF user control

I have a WPF UserControl containing a custom DependencyProperty named MyDP. I want to bind this to a property on my ViewModel (which is injected as the UserControl's DataContext). I know one way to do it by setting the binding in the UserControl's declaration in the parent window's XAML as such: <Window x:Class="MyNamespace.Views.Main...

How can I add a FlowDocument to a StackPanel?

I created the following class in order to have an easy way to display formatted text in a WPF document. However this solution returns a FlowDocument, and I am having trouble integrating this FlowDocument in my current application in which I was simply adding TextBlocks to StackPanels and WrapPanels and Borders, etc. How can I add the ...

How can I add multiple FlowDocumentReaders to a StackPanel?

Thanks to Leom's answer I was able to add a FlowDocument to a StackPanel by wrapping it in a FlowDocumentReader. But now I have two problems: it seems only the first FlowDocumentReader is added and the rest ignored there is an unwanted margin that I can't get rid of How can I add multiple FlowDocumentReaders to a StackPanel without ...

WPF Trigger animation when Visibility is changed?

Well i have a custom control and when Visibility is changed to Visible i have a trigger with a enter/exit action but the problem is that when the exit action fires the Visibility is no longer Visible so the animation can't be seen how would i fix this? here is my trigger: <ControlTemplate.Triggers> <Trigger ...

How do I set TextBlock height

How do I bind the height of TextBlock to the height of the parent control? I have a TextBlock inside a grid and I want the TextBlock height & width to be the height & width of the grid cell without hard coding the values. Cheers AWC ...

Unable to use DockPanel within Silverlight project C#

Hi! I am currently trying to resize a Telerik graph by placing it within a DockPanel because the Y axis label text keeps getting clipped when the graph is resized using "this.RadChart1.DefaultView.ChartArea.Height" in hope that this formatting error will be corrected. The problem I am currently experiencing with the "DockPanel" is that...

XAML Designer "cannot find type" when converters are in UserControl.Resources

I have a WPF UserControl with binding converters referenced like this: <UserControl x:Class="MyControl" x:Name="MyControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TheMainNamespaceOfThisAssembly"> <UserControl.Resourc...

DependencyProperty PropertyChangedCallback causes NullReferenceException in XAML

I've got a subclassed UserControl that is the content for my main window. I added a DepedencyProperty to my usercontrol, of type ResizeMode, and the PropertyChanged callback sets the ResizeMode of the main window to the value correctly. It runs fine. I can set it from the code behind, or from the XAML, and it works correctly. However, w...

Components in Silverlight?

I want to set up data binding using a custom component. Basically, I'd like to do something like this in my XAML file: <ControllerDataBindingBridge> <Bind TargetControl="eFirstName" Property="FirstName"/> </ControllerDataBiondingBridge> How do I create ControllerDataBindingBridge, there doesn't appear to be a simple Component whi...

How to draw a drop-shadow on a transparent rectangle?

When I add a dropshadow bitmap effect to a rectangle, the dropshadow takes into account the transparency of the rectangle (makes sense). Is there a way to render a dropshadow on a transparent rectangle 'as if' the rectangle were opaque? ie what would appear is a rectangle-shaped 'hole', with a dropshadow. Here is the XAML for a transpar...

xaml designer viewer doesn't load

Hi! When I add a resource on my main application (Application.xaml) then my pages doesn't load its design viewer because it tells me there is an error in one resource (DesignerItem.xaml). Otherwise in run time it works perfectly. Application.xaml: <Application xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" ...

How to style different items differently when using data template in xaml?

I would like my elements generated from datatemplate to look differently depending on some properties in the model. For example I want to display the text in various colors or present different images or path drawing for each generatred element. I know how to do it in general, but I'm looking for a solution that would allow editing the v...

Creating "flippable" content in Silverlight

I'm currently trying to build my personal website with Silverlight 3 and I've got this idea that you should be able to flip through the content in a certain way. I haven't seen exactly what I wanted before, so I uploaded a screenshot of the design for you guys to get a better idea of what I'm talking about: As you can see it's more or...

How to reuse a piece of XAML in a ContextMenu?

Say that I have the following piece of XAML: <Window> <StackPanel Orientation="Horizontal"> <Label>Phone:</Label> <TextBlock Text={Binding PhoneNumber}"/> </StackPanel> </Window> I would like to reuse this as the content of a ContextMenu. What is the best way to do that? ...

WPF/Silverlight Text Effect

Notice in the image below the 1px highlight below the text in the grey panel. How could this be achieved with WPF/Silverlight? . ...

WPF/Silverlight layout best practice

What would the best practice be for laying out the following item? . I am particularly interested in what controls I should use and how I position the delete icon to appear on the right-hand side and the tools icon to appear in the middle always? Thanks in advance. ...