How could I add some conditions changing list of MenuItems in a WPF Context Menu, depending on some attributes of clicked objects?:
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Name="EditStatusCm" Header="Change status" />
...
<MenuItem ... />
</ContextMenu>
</Grid.ContextMenu>
...
This has been bothering me for a while, maybe I am missing something.
The following throws an error with the commented attribute (expected >), but shouldn't I be able to do something like this?
<Label x:Name="Gaga"
FontSize="20"
<!--
Content="{Binding SomethingThatIsEmptyAtDesignTime"}
...
How can I bind to a UserControl's property from within its ResourceDictionary? I want an object I declare in my resources to have the same DataContext as the UserControl it is contained in:
<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xm...
I know that Binding in WPF is a really powerful feature, but I don't know if that is possible.
My window is composed of a really simple grid:
<Grid Height="593" Width="800" >
<Grid.RowDefinitions>
<RowDefinition Height="109*" />
<RowDefinition Height="484*" />
</Grid.RowDefinitions>
<Grid.Background>
...
I have a Linq to SQL EntitySet with a Foreign Key Relationship between two tables. The tables in question are a Task table (called Issues) and a Departments Table. The foreign key is the department name (Which is guaranteed unique). I am running into an issue in that you cannot change a Linq to SQL FK field if the corresponding data is l...
Flash has MXML and Microsoft has XAML.
What markup languages does Java have?
...
In a WPF app I have a custom control. I would like the ToolTip for objects, derived from this custom control, depends on a value of one of the attributes of this custom control.
Is it possible to declare it in a Control Template of this custom control?
Something like:
<ControlTemplate>
??? // <!--XAML ToolTip declaration -->
...
<Con...
Hi,
This should be simple, but I guess I'm missing something.
I have a simple user control containing a grid and 2 paths.
I would like to make this user control stretchable to any desired size, keeping the same relative position of the paths (the original work has much more paths with animation).
<UserControl
xmlns="http://schema...
I'm hoping this is an easy answer, as I'm just learning WPF.
I've got a resource dictionary that defines all our styles.
Currently the checkbox style looks like:
<Style x:Key="StandardCheckboxStyle" TargetType="{x:Type CheckBox}">
<Setter Property="Foreground" Value="{Binding Source={StaticResource BrandInfo}, XPath=//Colors/@TextC...
Hello.
I set up a ContentControl.DataTemplateSelector to my desired one.
I want that according to a command or whatever, call the ContentControl to reselect the template from the selector by either xaml or code.
Thank
...
<MenuItem x:Name="newProjectButton" Click="OnNewProjectButton_Click" Header="_New Project">
</MenuItem>
I want to call OnNewProjectButton_Click whenever Alt+N is pressed. The code above doesn't work, unfortunately, because the handler is called only if the menu is expanded (i.e. has focus).
...
I am trying to use in WPF a validating input of databound controls with validation rules. In the code behind file of a wpf window I have a class:
public class posintValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
...
I have a ControlTemplate that I'm using to change the appearance and behavior of several Buttons. I only want part of the Button to be clickable and to execute the bound Command, so I added a Button within the ControlTemplate and bound it to the template's Command property.
The problem I'm having is that since I am defining the Command ...
Using WPF, I have a ListBox control with a datatemplate inside it. The relevant XAML code is shown below:
<ListBox Name="_todoList" Grid.Row="1" BorderThickness="2"
Drop="todoList_Drop" AllowDrop="True"
HorizontalContentAlignment="Stretch"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Alterna...
I am trying to use in WPF a validating input of databound controls with validation rules. I have a posintValidationRule class:
public class posintValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
{
string _strInt = value.ToStri...
I've been using grids to hold my controls for a new app. Such as;
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinit...
I have a list of object bound to a DataGrid in a WPF page and I am looking to add an object directly after the current one if the value entered in a specific column is less than a certain number.
<my:DataGridTextColumn Binding="{Binding Path=Hours}"/>
I cannot for the life of me figure out how to bind to an event on the underlying Tex...
I'm puzzled. I'm trying to create a user control called TranslationView. It consists pretty much entirely of a single ListView. I don't think that's important now however, because I cannot even compile my code-behind.
This is the code-behind for the user control:
namespace Subster
{
/// <summary>
/// Interaction logic for Tr...
I have a View and a ViewModel in Silverlight 3.0.
The view contains a standard ScrollViewer, which contains dynamic content.
Depending on the content within the ScrollViewer, the user could have scrolled half way down the content, and then performed an action that causes the ScrollViewer to load new content, but the ScrollViewer does n...
I have a strange XAML Error that comes up in Visual Studio. I have Isolated it to the code below which causes it. The XAML designer errors when the converter below is used, however the application runs just fine without error. I like to keep the code tidy and remove all warnings and errors, what do I need to do to get rid of this one?
...