I have a ViewModel which exposes the string property PageToolBarVisible which can be true or false:
private string _pageToolBarVisible;
public string PageToolBarVisible
{
get
{
return _pageToolBarVisible;
}
set
{
_pageToolBarVisible = value;
OnPropertyChanged("PageToolBarVisible");
}
}
...
Thanks to the answer on this stackoverflow question I was able to get the following animation to work, so that when the value of my ViewModel property PageToolBarVisible causes the toolbar to fade in and out.
The problem is:
the toolbar opacity fades out, but it the space it took up is still present after it fades out
the initial tool...
This style correctly fades my toolbar in or out based on the changing of a ViewModel Property:
<Style x:Key="PageToolBarStyle" TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding PageToolBarVisible}" Value="true">
<DataTrigger.EnterActions>
<BeginStoryboard>
<...
I have a button, and when I click on it, I need it to peform as if I have just clicked the scroll wheel on my mouse. Is this possible?
<Button x:Name="centreButton" Click="performScrollButtonClick"/>
...
The View and ViewModel listed below show two buttons:
when you click Show ToolBar, the toolbar fades in
when you click Hide ToolBar, the toolbar fades out
However, the following things don't work:
when the application is loaded and OnPropertyChanged("PageToolBarVisible") is fired, if the value is false then the Toolbar shows in spi...
Hi,
In WPF, I would like to be able to template how my bindings are applied by default.
For instance, I want to write :
Text="{Binding Path=PedigreeName}"
But it would be as if I had typed :
Text="{Binding Path=PedigreeName, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, Valid...
I am trying to inherit application-level styles for a certain Window in my WPF application, but I'm having trouble getting it to inherit rather than simply override the existing styles.
In App.xaml (under the App.Resources element) I define a style as such:
<Style TargetType="Button">
<Setter Property="Padding" Value="6"/>
<Set...
Suppose I want to show list of objects where each object should have a name and a suitable image (for example MenuItems with Icons, or buttons with text and image).
All examples and programs exposed the image in the viewmodel as a path to a PNG file and then bound the Source of an Image to that. But what if I want to use vector images (...
How can I vertically align a Label and TextBlock at Top so that their first lines of text line up?
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Column=...
Is there a way to convert HTML into XAML?
I noticed that you can paste HTML into a RichTextBox and you can get the XAML by looking at the FlowDocument. However, this is a hack.
Is there a better way?
...
I have a class CollectionOfThings. As its name suggests its a simple collection of instances of the Thing class. Thing class has a public default constructor and two simple public get, set properties ID and DisplayName, both are string. CollectionOfThing also has public default constructor.
In XAML I would like to use markup like thi...
In my XAML file I want to display this text which contains double and single quotation marks:
You shouldn't choose "Copy if New".
None of these work:
<TextBlock Text="You shouldn't choose "Copy if New":"/>
<TextBlock Text="You shouldn't choose ""Copy if New"":"/>
<TextBlock Text="You shouldn't choose \"Copy if New\":"/>
<TextBlock...
I want to put a command on a ListBoxItem. The ListBoxItem use a DataTemplate composed of a StackPanel (containing an Image and a TextBlock, both using Binding). I want that the doubleclick on that ListBoxItem fire the command.
I have tried this :
<DataTemplate>
<StackPanel>
<StackPanel.Resources>
<CommonUI:Comma...
Hi,
I have a WPF application with several windows. I would like to define GLOBAL inputBindings.
To define LOCAL inputbindings, i just declare the input in Window.InputBindings or UserControl.InputBindings.
To define GLOBALs, I wish i could do the same with the Application class...
<Application
....>
<Application.InputBindings>
...
...
I want to create an area in my application that looks draggable. Usually, you see this done with a background of small dots or squares, or sometimes lines. I'm using Silverlight and I want to simply create a background that is a set of repeating small rectangles. I honestly cannot figure out how to generate a background with xaml. I'...
I would like to be able to use vector graphics, preferably defined in XAML, as the Source of an Image control, just like I can currently use a raster image like a PNG. That way I could easily mix and match between bitmap and vector images, like this:
<StackPanel>
<Image Source="Images/Namespace.png"/>
<Image Source="Images/Modul...
I design a form in WPF project. The xaml content is automatically generated based on the GUI I design (drag/drop,set position on GUI). How can I read/retreive the xaml content data by code in C# on form?
...
What is the thinking/philosophy behind having tunneling before Bubbling and not viceversa .
...
I am working with Blend and Visual Studio to create Surface content.
Pretty much every item I place and customize in Blend will look different at runtime or when looked at in Visual Studio.
The cause of this seems to be because width/height is not always set in the XAML-file - only margins. If the size of the workspace is different thi...
I've defined a DataTemplate in a ResourceDictionary. The template need some data (for populating a ListBox). Previously the template was a UserControl and the data was provided by setting the DataContext property.
Is there some way of using code-behind for a DataTemplate or is using an ObjectDataProvider to provide the data the only opt...