xaml

IsMouseOver within a Button

Hi all, I'm creating a button with a down arrow: The arrow is actually a button within a button. When the mouse is at the location I pointed out with a red dot it looks like this (which is good): The inner button lights up okay. But when going slightly up it looks like the following picture (not good, the inner-button is not sel...

access system:string resource dictionary xaml in C#

Hello! How do I access the contents in a resource dictionary using C#? for example, here is my code in XAML: <system:String x:Key="NewGroup">New Group Name</system:String> and i want to access it here in C# private void OnAddGroup(object sender, ExecutedRoutedEventArgs e) { BooksGroupInfo group = new BooksGroupI...

Bind objects to XAML collection

Is it possible to use binding to add objects to a XAML collection. something like <x:Array Type="sys:Int32"> <Binding Source="obj", Path="Prop1"/> <Binding Source="obj", Path="Prop2"/> </x:Array> ...

Custom silverlight user controls do not appear in Blend Assets tab.

I've created a control in blend (xaml and code behind), saved it, and rebuilt the entire project. Now, not only does this new control not appear in the Assets tab in blend, none of the other user controls i've created appear either. I've rebuilt several times, blown away the obj and bin directories and rebuilt again, to no avail. How ...

Hierarchical Data Structure WPF TreeListView DataTriggers

Hi I am trying to make a tree list view that displays different information compared to the parent. From what i have now, the Children display the same information as the parent. I was wondering, how i would do this. The last post i had didn't really quite make sense to me, it didn't work really well. I was wondering if anyone can expl...

How to assign a dynamic resource style in code?

I want to produce in code the equivalent of this in XAML: <TextBlock Text="Title:" Width="{Binding FormLabelColumnWidth}" Style="{DynamicResource FormLabelStyle}"/> I can do the text and the width, but how do I assign the dynamic resource to the style: TextBlock tb = new TextBlock(); tb.Text = "Title:"; tb.Wid...

How can I get the Text value of a TextBox whose Name gets assigned at runtime?

I am creating a TextBox with the following code: TextBox textBox = new TextBox(); textBox.Name = propertyName; textBox.Text = value; textBox.Width = FormControlColumnWidth; textBox.SetResourceReference(Control.StyleProperty, "FormTextBoxStyle"); sp.Children.Add(textBox); //StackPanel FormBase.Children.Add(sp); On a button click, I wa...

Size a TextBlock to a Button that changes Width dynamically

Hi, I have a TextBlock that's on top of a Button in a Grid. I'd like to have then displayed thus: "some very long text" <-- text "that doesn't fit" <-- text wrapped [my button text size] <-- button However, what I've got is this: "some very long text that doesn't fit" <-- text [my button text...

Why can't I access a TextBox by Name with FindName()?

Why does FindName() return null in the following example? XAML: <Window x:Class="TestDynamicTextBox343.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"> <StackPanel> <Border > <D...

notify all subcontrols in WPF with specific attributes

Hi there, how can i inform all subControls in WPF that they shall for example expand? Not every SubControl shall be informed.. only those who can e.g. accept an other element for drop. Perhaps you know another posibilty to let the items change their color when they do accept specific dropContent. Thanks, el ...

Binding to a string value that should then bind to a Resource, what wrong here ?

Hi, I have a class with the following properties: Message(string), Added(DateTime) and LogLevel(string) In my App.xaml i have the following: <Application.Resources> <ImageSource x:Key="Critical">Gfx/Log/Critical.png</ImageSource> <ImageSource x:Key="Info">Gfx/Log/Information.png</ImageSource> <ImageSource x:Key="Error">Gfx...

How can I programatically create a WPF Toolkit DataGridTemplateColumn?

I was able to recreate this XAML DataGridTextColumn: <tk:DataGridTextColumn Binding="{Binding FirstName}" Header="First Name"/> in code like this: DataGridTextColumn dgtc = new DataGridTextColumn(); dgtc.Header = propertyLabel; dgtc.Binding = new Binding(propertyName); theDataGrid.Columns.Add(dgtc); But how do I recreate th...

How can a method in C# be used in XAML ?

I have a method creating a cone, such as in the following code snippet. Could you explain me how this cone created by CreateCone(...) can be used in a XAML file in the same solution. C# Code snippet : public partial class MainWindow : Window { public Window() { InitializeComponent(); CreateCone(new Point3D(0, 0, 0...

WPF/XAML: how to make all text upper case / capital?

hi, here's my problem: I want all texts in TextBlock, Label, MenuItem.Header to be displayed in upper case. The strings are taken from a ResourceDictionary e.g.: <TextBlock Text="{StaticResource String1}"/> <MenuItem Header="{StaticResource MenuItemDoThisAndThat} etc. (also for Label and other controls) I cannot use a value c...

MenuItems, static and bound items, Child items dont show up.

Hi, I have the following Menu witch works to some point ... then I added the two MenuItems under the Binding Item ... so each binded item would get a Delete and Edit MenuItem. <MenuItem x:Name="miUserList" Header="User" Click="miUserList_Click" > <MenuItem Header="Add new user"></MenuItem> <MenuItem.ItemTemplate> <DataT...

Property inheritance in WPF/Silverlight?

In WPF and Silverilght, what are the rules for deciding if you inherit properties from the visual, declarative, or logical parent? ...

WPF - Style for the scrollbars and background on a RichTextBox

What's required to create a style for a RichTextBox that includes visuals for the scrollbars and a background color for the space behind the text? ...

TreeListView Displaying different information than it's parent. WPF

Hi. I have tree list view NOT A tree view. I would like it to display different information than the parent. With the different columns I want to have the parent to display: Name Task and Activity code. The CHild to display Start Time End Time and Total Hours. But i would like the child columns to match the parent columns such ...

a 3D mesh object created in behind code

Hi All, I have a 3D object created by a method in behind code - C# and want to use in XAML code in the same solution. Could one say me how to do, please. Thanks. J.R. ...

WPF - How to expose subelements of a UserControl

I have created a XAML UserControl that is used to enter the current date using some up/down controls. The interesting parts of the UserControl are as follows: <UserControl x:Class="MyApp.Controls.DateEntry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:uCon...