I created my own ContentCOntrol in XAML, e.x.:
<ContentControl x:Class="server.ui.DiamondButton">
<ContentControl.Template>
<ControlTemplate TargetType="src:DiamondButton">
<...>
</ControlTemplate>
</ContentControl.Template>
</ContentControl>
This sets the default template and generally works great....
I want to add a dependency property to a UserControl that can contain a collection of UIElement objects. You might suggest that I should derive my control from Panel and use the Children property for that, but it is not a suitable solution in my case.
I have modified my UserControl like this:
public partial class SilverlightControl1 : ...
I'm working on a WPF interface that reads an XML file and displays the data. The XML file would be something like this:
<People>
<Person Gender="Male">
<Name>Joe</Name>
</Person>
<Person Gender="Female">
<Name>Susan</Name>
</Person>
</People>
I need a data template dependent on the Gender attribute of ...
Hello all!
I declared a style that I want to apply to ALL the buttons in the project, the style resides in the ResourceDictionary:
<Style TargetType="StackPanel">
<Setter Property="Orientation" Value="Horizontal" />
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>...
Hello folks!
I am trying to set padding of a StackPanel but there ain't such property.
I tried StackPanel.Border, but there is no such property either.
Any ideas?
...
I have a window that get its data from another class that is passed as DataContext. But I now also want to do data binding within the window. The window looks as follows:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xa...
Can anyone recommend a good WPF localization tool that will do the following:
Correctly handle WPF styles
Can do binary localization, where no source code is available
At least one tool I have tried has failed to generate working satellite assemblies when the source assemblies use WPF styles.
...
I have a ListBox which is bound to ObservableCollection of LogMessages.
public ObservableCollection<LogMessage> LogMessages { get; set; }
public LogMessageData()
{
this.LogMessages = new ObservableCollection<LogMessage>();
}
Each Message has two parameters:
public class LogMessage
{
public string Msg {...
I wrote a file browser in XAML/C#.
Files are listed in a listView
<ListView Margin="230,0,0,0" Name="listViewContent" ItemsSource="{Binding ContentCollection}">
<ListView.View>
<GridView>
<GridViewColumn Header="Title" Width="290">
<GridViewColumn.CellTemplate>
...
There is a very similar question already posted. In fact, the result of the answer in that post is exactly what I'm after, but I have no codebehind to place that code in. All of our logic is encapsulated in a ViewModel. Since the ViewModel is not supposed to have direct references to specific visual elements, this code cannot exist there...
Hi,
I'm trying to change the content of a ContentPresenter to one of my View Model class. I manage to have it shown properly, once I change this content (property) from my model, it doesn't update the ui.
The following lines link my view model classes to their respective ui (setting their data context automatically) :
<DataTemplate...
Say I have a Date, or a Phone number, or some Class which I don't actually want to store as a string at runtime, but which could have a nice short string serialization for serialization as a XAML attribute:
<Person PhoneNumber="+1-123-123-1234"/>
How do I make my type serialized in that representation?
...
I need to bind a collection of strings inside a collection of strings to a DataGrid (Infragistics).
However, when I bind it like this:
<DataPresenter:XamDataGrid x:Name="xamDataGrid" DataSource="{Binding TheCollection}">
to either this:
public List<string[]> TheCollection
or this:
public List<List<string>> TheCollection
I get t...
Any suggestions how to go about having a XAML vector image as a Window background? There's plenty of code showing this with jpg's but I'd prefer a vector based image.
Having it as a resource would be a bonus too but I'm stumped as to the best approach.
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation...
HI,
I have a XAML file where i have defined the UI elements.
In my code behind for the window, i add some uielements into one of the controls i have in the xaml file, and when I run it, it does not show up my control that i have added using the c# code.
For checking purposes, i tried to remove all controls i had setup via the XAML, in ...
I can set margins individually in code but how do I do it in XAML, e.g. how do I do this:
PSEUDO-CODE:
<StackPanel Margin.Top="{Binding TopMargin}">
...
<Button IsEnabled="{Binding (Not IsDisabled)}" />
Is there a way to do it with pure xaml, or I will have to do it via code?
PS. I asked the question knowing that I can create a boolean converter like this:
<ValueConversion(GetType(Boolean), GetType(Boolean))>
Public Class BooleanFlagSwitchConverter : Implements IValueConverter
...
Hi
I want to set the UpdateSourceTrigger to an event of a control:
<TextBox Text="{Binding Field, UpdateSourceMode=btnOK.Click}">
<Button Name="btnOK">
<Button.Triggers>
<Trigger>
<!-- Update source -->
</Trigger>
</Button.Triggers>
</Button>
I thought about two ways:
Set UpdateSourceMode or some...
Hi!
I have a ListBox that each of its items has a button, I set all the textboxes in the dataitem that the Binding.UpdateSourceTrigger is Explicit.
I added a handler to the button's click, now what?
How do I collect the info from the controls? they don't have a key they are dynamic, how do I get their BindingExpressions?
<ListBox Ite...
Hi,
I need to override the behaviour of XamlWriter when writing out a user control to file.
I have control which is just a grid with pictures in, the usercontrol has the grid and 4 properties which set the images.
When i use XamlWriter.Save it returns the inner xaml (which includes the grid etc) of the user control, however I just wa...