xaml

How can I change styles of XAML file using Data Binding?

I'm binding a collection of objects to a listbox in WPF, for simplicity we'll say the object i'm binding has 3 propertys: Name, URL, IsBold. What I want to do, is have it displayed different if the IsBold is set to true, again as an example I want to set the TextBlock that Name appears in, to be bold. Is something like this even possib...

Using GraphViz in a WPF application

I want to use GraphViz in my WPF application without installing Graphviz. Does AT&T (or somebody else) distribute such a DLL? Thanks, Kemal ...

Change image using trigger WPF MVVM

Hi All, This may be a no brainier but I just can't seem to get it to work. I have a view model that exposes a property called bool NotFound I would like to bind that to a trigger so that when it changes an image on my control changes. This is the xaml that I am using as a data template for one of my view models. <DataTemplate DataTyp...

Silverlight ItemsControl

Hello, I am trying to use an ItemsControl to display a DataTemplate. I have this simple example: <navigation:Page.Resources> <DataTemplate x:Key="PictureResultsTemplate"> <!--<Grid/> --> <TextBlock Text="Nick Was Here"></TextBlock> </DataTemplate> </navigation:Page.Resources> <Grid x:Name="LayoutRoot"> <Grid Margin="0,0...

Fit XAML path into view

Hi all, I have the following path. The data is from some data file: <Path StrokeThickness="5" Stroke="Black" Fill="Yellow" Data="M 30330.8847248349,-37724.909002528 L 28556.3829935257,-37596.5557453925 28031.7660050946,-38008.0608378072 27746.4689258268,-38895.6687979239 27655.7148993139,-39397.1764657993 27718.5888966473,-39755.495543...

Expander.IsExpaned only if current template is a descendant of a ToolTip.

Hello. I am using a DataTemplate (a StaticResource) in several places in my application as in an ItemsControl, ContentControl and in a ToolTip. The template contains an Expander, and I want its IsExpanded property to be true if the DataTemplate is located within a ToolTip. Any recommendations? ...

Expression Blend Release mode

I work almost exclusively in Release mode since debugging it is good enough for the rare times I need to debug. I've recently started trying to use Expression Blend 3 for my xaml, but it seems to only work with the debug version of my project. Is there any way to change this? I'd really like to avoid having to build everything debug...

WPF Binding Custom Output Window

I am trying to create a custom Output Window for my software that is bound to my ViewModel. Usually in the past I have always used a TextBox and used the appendText() method to write to the Output Window. Of course with a ViewModel and trying to bind to a Textbox, it seems you can only Bind to the Text property. Below is what I am trying...

XAML Indexer DataBinding

I have got an Indexer property in a Class called X, suppose X[Y] gives me a another object of Type Z <ContentControl Content="{Binding X[Y]}" ...??? How can I make a DataBinding happens inside indexer? It works if I do {Binding [0]} . But {Binding X[Y]} just takes the indexer parameter as a string which is "Y" Update : Converter i...

WPF TreeView making the children nodes clickable.

Hi everybody! I am making a WPF program that contains a TreeView. I am having a problem right now. I am using an attached command behavior to try to open a TreeView children tree view item. Basically, the treeView item contains an ID and when you double click it. It will bring another window up showing the details that are associated...

WPF binding to another property's binding in a style

I'm not sure the best way to ask this question (sorry for the ambiguous question title), but essentially I'd like to set the MaxLength property on a TextBox using a value converter that is passed in a property from the data context, and the property on the passed-in property as the converter parameter. I'd like to do all this in a style,...

ZOrder of Expander with Canvas inside of List

I have a list which contains some controls, including an expander. Within the expander is another list, which I want to overlay the outer list. Here's a simple repo: <Page.Resources> <x:Array x:Key="array1" Type="sys:String"> <sys:String>item 1</sys:String> <sys:String>item 2</sys:String> <sys:String>item 3</sys:String>...

Getting URI's for XAML types at runtime

I'm trying to make a bit of code like this work: Type pageType = typeof(Page1); Uri pageUri = GetPackUriForType(pageType); The problem is the GetPackUriForType method - I can't find anything in the .NET framework that will do this. In the .g.cs files that are built at compile time, the URI is embedded as part of the InitializeCompon...

Center multiple XAML paths into view

Now this question looks similar to the question I've asked here, however, this time I have multiple Path objects. I want to create a control that centers the paths nicely. Example: <Grid> <Path Stroke="Black" Data="M 3,3 L 7,4 3,12 3,3" /> <Path Stroke="Black" Data="M 3,6 L 7,4 12,6 3,6" /> </Grid> Is there an easy way to ac...

How to show some animation while control is rendering?

I have WPF ListBox that shows a lot of data. I need smooth scrolling, so I've set ListBox.ScrollViewer.CanContentScroll to False that disables virtualization. Now when I open tab where this ListBox is placed, I see nothing for few seconds because ListBox is loading/creating items/rendering. I also have a control that shows some animation...

Style a border with a different brush color for each corner

I have created a static resource defining the border of a specific item in my xaml, but I can't find a good way to define a unique color for each side! xaml: <Border Style="{StaticResource SidePanelBorder}"> <!-- rest of the xaml --> </Border> StaticResource: <Style x:Key="SidePanelBorder"> <Setter Property="Control.Bord...

How to specify two DataTemplates for single type?

I defined in XAML DataTemplate for my own type. <DataTemplate DataType="{x:Type MyType}"> ... </DataTemplate> Now I want to add one more template for the same type in the same scope. How would I choose then which of templates to use in concrete ItemsControl? Background: I have ItemsControl that displays objects of different types...

How to create multiline textbox which shows apostrophe before each line

I want a multiline textbox which shows apostrophes before and after each line. So that the textbox looks like: " Hello this " " is a funny " " string test " Or for example: // This is // a muliline // comment. Edit: These special characters must be readonly and if the user copies text from the textbox these characters should not ...

WPF - TextBlock - Format Text Progrmatically

In the TextBlock object you can format the text in the XAML like this: <TextBlock> <Bold>bold text</Bold> random non bold next </TextBlock> How do you do the "Bold" tags programmatically? I tried just putting them in the text property and it just printed them out (the tags were printed as text). ...

Programatically Accessing a Silverlight Static Resource

I'd like to programatically access static resources much as I would in XAML: <TextBlock Text="{Binding Source={StaticResource My.Text.Key}}" /> This works whether my static resource is defined on the TextBlock, some parent element (e.g. UserControl) or even the application. It seems that either the StaticResource binding expression k...