Search Results

Search found 5961 results on 239 pages for 'wpf 4 5'.

Page 154/239 | < Previous Page | 150 151 152 153 154 155 156 157 158 159 160 161  | Next Page >

  • Why is button background defaulting to grey when IsPressed is true

    - by Dave Colwell
    Hey all, I have a simple problem. Using the IsPressed trigger i want to be able to set the background color of a button to something other than the default grey. Here is what the button looks like when it is not pressed and here is what it looks like when it is clicked Here is the trigger for the button. I know the trigger is firing correctly because of the glow effect around the edge of the button when it is clicked. I also know that the brush is correct because i tried it out as a background brush to see what it looked like. <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="{DynamicResource ButtonHoverBrush}"/> <Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/> </Trigger> <!-- This is the trigger which is working but the background color wont change --> <Trigger Property="IsPressed" Value="True"> <Setter Property="BitmapEffect" Value="{DynamicResource ButtonHoverGlow}"/> <Setter Property="Background" Value="{DynamicResource ButtonPressedBrush}" /> </Trigger> </Style.Triggers>

    Read the article

  • Trigger doesn't work

    - by Pasha
    Hello everyone, I have an user control, It is editable text block. The content of the control is: <DataTemplate x:Key="DisplayModeTemplate"> <TextBlock Text="{Binding ElementName=mainControl, Path=FormattedText}" Margin="5,3,5,3" /> </DataTemplate> <Style TargetType="{x:Type Controls:EditableTextBlock}"> <Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}"/> <Style.Triggers> <Trigger Property="IsInEditMode" Value="True"> <Setter Property="ContentTemplate" Value="{StaticResource EditModeTemplate}" /> </Trigger> <Trigger Property="IsInEditMode" Value="False"> <Setter Property="ContentTemplate" Value="{StaticResource DisplayModeTemplate}" /> </Trigger> </Style.Triggers> </Style> </UserControl.Resources> Also i have another window with tree view: When treeView1_KeyDown fires I set IsInEditMode to true, but it seems that trigger doesn't work, because content template don't change. Anyone, please explain me why?

    Read the article

  • How are DynamicResources built and their use in contextmenus.

    - by miguel
    Are dynamic resources truly dynamic? If I define a DynamicResource, I realise that an expression is created (where?) that is not translated into a resource until runtime, however, What I do not understans is whether this dynamicresouce, once built, is now "Static" For instance, if I create a context menu via a dynamicresource, are the menuitems which are created at runtime on access then static, even if they are bound? If so, how can i create a dynamic context menu in XAML?

    Read the article

  • ContentTemplateSelector is only called one time showing always the same datatemplate

    - by msfanboy
    Hello, I have made a sample demo VS 2010 RC sample project, because in my production project I have the same error using MVVM. In my sample demo project I use only Code-behind without 3rd party dependencies so you can download the demo project here and run it for yourself: http://www.sendspace.com/file/mwx7wv Now to the problem: When I click the girls/boys button it should switch the datatemplate, not? What do I wrong?

    Read the article

  • MouseOver Trigger firing on ContextMenu with overridden ControlTemplate. Where is it coming from?

    - by Dabblernl
    I have this very simple ControlTemplate: <ControlTemplate TargetType="{x:Type ContextMenu}"> <Border Name="Border" Background="{StaticResource BlueBackground}" BorderBrush="LightBlue" CornerRadius="10" BorderThickness="1" > <StackPanel IsItemsHost="True"/> </Border> </ControlTemplate> I made it to create a nifty jawdroppingly beautiful rounded corner! However, when I point the mouse over a contextmenu a MouseOver Trigger fires from somewhere that draws a terribly ugly nearly square border on top of my nifty rounded border! Where is it coming from?? EDIT: The most likely cause is that the ContextMenu is an ItemsControl that holds MenuItems, even when my ContextMenu holds a single UserControl. So the UserControl is seen as a MenuItem and highlighted when the IsMouseOver==true! What is the easiest way to disable this behaviour?

    Read the article

  • Why use MVVM???

    - by LnDCobra
    Okay, I have been looking into MVVM pattern, and each time I have previously tried looking into it, I gave up for a number of reasons: Unnecessary Extra Long Winded Coding No apparent advantages for coders (no designers in my office. Currently only myself soon to be another coder) Not a lot of resources/documentation of good practices! (Or at least hard to find) Cannot think of a single scenario where this is advantageous. I'm about to give up on it yet again, and thought I'd ask to see if someone answer the reasons above. I honestly can't see an advantage of using this for a single/partner coding. Even in complex projects with 10's of windows. To me the DataSet is a good enough view and binding like in the answer by Brent following question

    Read the article

  • How to set Height of items in XAML so they always occupy the same proportion of available space in p

    - by aoven
    I have an ItemsControl with the following ItemTemplate: <DataTemplate x:Key="myItemTemplate"> <TextBlock Height="???" Text="{Binding Path=Description}" /> </DataTemplate> My question is, how do I set the Height of the TextBlock in the template so that it automatically assumes ItemsControl.Height div ItemsCount amount of vertical space? When there's only one item, I'd like it to be the full height of container, when there're two, each should be half the size, and so on. If possible, I'd prefer to do this completely in XAML to keep my ViewModel clean of UI logic.

    Read the article

  • Where has XamlPad gone in .NET 4.0 / Windows SDK v7.1 / Visual Studio 2010?

    - by elck03
    I can't find XamlPad anywhere after I installed .NET 4.0 / Visual Studio 2010 and Windows 7 SDK - v7.1. I tried searching C:\Program Files\Microsoft SDKs\Windows\v7.1\bin and did a dir /s xamlpad.exe to see if the Windows Index service didn't get to that folder yet. And it's not under Start Menu - All Programs - Windows SDK v7.1 -- Tools. Where has it gone? Did MS deprecate it? Thanks

    Read the article

  • Why does my adorner not re-render when the element it's applied to changes?

    - by Robert Rossney
    In a UI I'm building, I want to adorn a panel whenever one of the controls in the panel has the focus. So I handle the IsKeyboardFocusWithinChanged event, and add an adorner to the element when it gains the focus and remove the adorner when it loses focus. This seems to work OK. The problem I'm having is that the adorner isn't getting re-rendered if the bounds of the adorned element changes. For instance, in this simple case: <WrapPanel Orientation="Horizontal" IsKeyboardFocusChanged="Panel_IsKeyboardFocusChanged"> <Label>Caption</Label> <TextBox>Data</TextBox> </WrapPanel> the adorner correctly decorates the bounds of the WrapPanel when the TextBox receives the focus, but as I type in text, the TextBox expands underneath the edge of the adorner. Of course as soon as I do anything that forces the adorner to render, like ALT-TAB out of the application or give another panel the focus, it corrects itself. But how can I get it to re-render when the bounds of the adorned element change?

    Read the article

  • Setting TreeView.DataContext doesn't refresh the tree

    - by dan gibson
    I have a List that I've bound to a TreeView. Setting TreeView.DataContext works - everything displays correctly. I then change the list (add an item to it) and set TreeView.DataContext again (to the same value) but the tree does not refresh with the new items. How do I get the treeview to refresh? This is basically my code: public class xItemCollection : ObservableCollection<xItem> { } public class xItem : INotifyPropertyChanged { xItemCollection _Items; public xItem() { _Items = new xItemCollection(); } public xItemCollection Items {get{return _Items;}} } ... this.RootItem = new xItem(); treeView.DataContext = this; Adding items to the list works until the tree is rendered for the first time. After it is rendered, adding/removing items does not refresh the tree.

    Read the article

  • Best way for programmers to edit XAML

    - by JessicaB
    I was wondering how programmers chose to edit XAML. Most of the programmers I speak to seem to edit the raw XML, but that seems nuts to me since it is such a natural thing for a more visual editor (of course you often have to get down to the raw code ultimately, but isn't there a better way to lay out a grid, or edit a template, or add non c# triggers or manage commands? The one that really set me off was editing a menu -- Visual Studio 1.0 had a better menu editor for C++ than the raw XAML editing experience.) When I edit .aspx files I use a visual editor much of the time, and then for the raw stuff I get into the html code. I am aware of Expression Blend, but that seems far more focused on artistic types and GUI experts rather than programmers. Does anyone have recommendations for a better editor for XAML than VS? Especially so since VS seems to have real nasty problems with XAML editing too, like bugginess and poor performance? Appreciate your helping this XAML newbie.

    Read the article

  • How to make XmlnsDefinition work on the local assembly?

    - by Scott Bilas
    I've started using the XmlnsDefinition attribute to tie together some CLR namespaces into a single xmlns for convenience in XAML. Unfortunately, it seems that this only works when using foreign assemblies. If I have a XAML file in the same assembly as the types that are in the namespace I'm referencing from XmlnsDefinition, then it says the type does not exist in the xmlns I am defining. Moving the type to a foreign assembly fixes the problem. Is there a way to use XmlnsDefinition on an assembly and have it be used from within that assembly via XAML?

    Read the article

  • MVVM- How can I bind to a property, which is not a DependancyProperty?

    - by highone
    I have found this question http://stackoverflow.com/questions/2245928/mvvm-and-the-textboxs-selectedtext-property. However, I am having trouble getting the solution given to work. This is my non-working code: View: SelectedText and Text are just string properties from my ViewModel. <TextBox Text="{Binding Path=Text, UpdateSourceTrigger=PropertyChanged}" Height="155" HorizontalAlignment="Left" Margin="68,31,0,0" Name="textBox1" VerticalAlignment="Top" Width="264" AcceptsReturn="True" AcceptsTab="True" local:TextBoxHelper.SelectedText="{Binding SelectedText, UpdateSourceTrigger=PropertyChanged}" /> <TextBox Text="{Binding SelectedText, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" Height="154" HorizontalAlignment="Left" Margin="82,287,0,0" Name="textBox2" VerticalAlignment="Top" Width="239" /> TextBoxHelper public static class TextBoxHelper { #region "Selected Text" public static string GetSelectedText(DependencyObject obj) { return (string)obj.GetValue(SelectedTextProperty); } public static void SetSelectedText(DependencyObject obj, string value) { obj.SetValue(SelectedTextProperty, value); } // Using a DependencyProperty as the backing store for SelectedText. This enables animation, styling, binding, etc... public static readonly DependencyProperty SelectedTextProperty = DependencyProperty.RegisterAttached( "SelectedText", typeof(string), typeof(TextBoxHelper), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, SelectedTextChanged)); private static void SelectedTextChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { TextBox tb = obj as TextBox; if (tb != null) { if (e.OldValue == null && e.NewValue != null) { tb.SelectionChanged += tb_SelectionChanged; } else if (e.OldValue != null && e.NewValue == null) { tb.SelectionChanged -= tb_SelectionChanged; } string newValue = e.NewValue as string; if (newValue != null && newValue != tb.SelectedText) { tb.SelectedText = newValue as string; } } } static void tb_SelectionChanged(object sender, RoutedEventArgs e) { TextBox tb = sender as TextBox; if (tb != null) { SetSelectedText(tb, tb.SelectedText); } } #endregion } What am I doing wrong?

    Read the article

  • Is using value converters to generate GUI-friendly strings a misuse of value converters?

    - by tempy
    Currently, I use value converters to generate user-friendly strings for the GUI. As an example, I have a window that displays the number of available entities in the status bar. The Viewmodel simply has an int dependency property that the calling code can set, and then on the binding for the textbox that displays the number of entities, I specify the int dependency property and a value converter that changes "x" into "x entities available". My code is starting to become littered with these converters, and I have a large number of annoying resource declarations in my XAML, and yet I like them because all the GUI-specific string formatting is being isolated in the converters and the calling code doesn't have to worry about it. But still, I wonder if this is not the purpose that value converters were made for.

    Read the article

  • Scale transform in xaml (in a controltemplate) on a button to perform a "zoom"

    - by Matt B
    Hi all, I've got a button with an image in it and it's being styled by the following: <ControlTemplate x:Key="IconButton" TargetType="Button"> <Border> <ContentPresenter Height="80" Width="80" /> </Border> <ControlTemplate.Triggers> <EventTrigger RoutedEvent="Button.Click"> <BeginStoryboard> <Storyboard TargetProperty="Opacity"> <DoubleAnimation From="1" To="0.5" Duration="0:0:0.5" /> <DoubleAnimation From="0.5" To="1" Duration="0:0:0.5" /> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="Mouse.MouseEnter"> <BeginStoryboard> <Storyboard TargetProperty="Width"> <DoubleAnimation From="80" To="95" Duration="0:0:0.2" /> </Storyboard> </BeginStoryboard> </EventTrigger> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Cursor" Value="Hand"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> Button is as follows: <Button Template="{StaticResource IconButton}" Name="btnExit"> <Image Source="Images/Exit.png" /> </Button> The problem is that the width doesn't change when my mouse goes over. (Or at least - the width of the image does not...) I believe there is a "scale" transform I can use to enlarge the button and all it's contents? how would I do that here...? Thanks.

    Read the article

  • Databinding combobox selected item to settings

    - by Tuukka
    I store user specified settings using application settings properties and databinding. It has been working fine, until i want user selected to font for combobox. Databinding between user settings and combobox not working. I want to store font family name. App.XML <Application.Resources> <ResourceDictionary> <properties:Settings x:Key="Settings" /> </ResourceDictionary> </Application.Resources> Window.XML <ComboBox Name="Families" ItemsSource="{x:Static Fonts.SystemFontFamilies}" <!-- This line --> SelectedItem="{Binding Source={StaticResource Settings}, Path=Default.Font, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Margin="57,122,199,118"> <ComboBox.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding}" FontFamily="{Binding}"/> </DataTemplate> </ComboBox.ItemTemplate> </ComboBox> Settings: font String User Arial

    Read the article

  • Menu item for each module, with module content loading dynamically with Prism or MEF

    - by user573145
    I am developing an application currently using Prism and MEF. I would ideally like to generate a toolbar or menu with an item for each module, and when an item is clicked, only the views declared within that module load into a tab control. For example: Menu Region: ModuleA(Selected) | ModuleB Tab Region: ModuleAViewA | ModuleAViewB | ModuleAViewC Changes to Menu Region: Employees | Inventory(selected) Tab Region: Items | In Fi

    Read the article

  • Why is this method executing twice each time I call it?

    - by highone
    I have the following method that is executing twice every time it is called: public static void ChangeToRepository(RepositoryTextBox textBox, int repositoryNumber) { MessageBox.Show("you"); int indexOfLastRepository = (textBox.RepositoryCollection.Count - 1); if (repositoryNumber > indexOfLastRepository) { AddTextRepositoriesThrough(textBox, repositoryNumber, indexOfLastRepository); } textBox.RepositoryCollection[textBox.CurrentRepositoryNumber].CurrentText = textBox.Text; textBox.PreviousRepositoryNumber = textBox.CurrentRepositoryNumber; textBox.CurrentRepositoryNumber = repositoryNumber; textBox.Text = textBox.RepositoryCollection[textBox.CurrentRepositoryNumber].CurrentText; } The first time that the method executes, it executes all of the code except for its last line: textBox.Text = textBox.RepositoryCollection[textBox.CurrentRepositoryNumber].CurrentText; The second time, it executes all of the code. What's up?

    Read the article

  • MS Surface Tag Visualizer steals contact events

    - by Isak Savo
    I'm struggling with the TagVisualizer control on an MS Surface project. In theory the control seems great, allowing you to respond to input from real world physical objects The problem is that the control will cover the entire screen (since I want to capture tags on the entire screen) and as such, no other controls in my app will receive the touch events. (Unless, they are direct ascendants in the visual tree). In my app, I want to have a "layer" type of a approach, where each layer can respond to (contact) input: Window `- Grid `- LayersPanel `- TagVisualizer `- Layer 1 `- Layer 2 `- Layer 3 `- Layer 4 Now it doesn't matter where I put the tag visualizer, it's always going to steal contact events from all or some of the other layers. (due to the nature of RoutedEvents) To me, it seems like the control is completely useless in practice as it will always interfere with your application's other controls. What am I missing here? So my questions are: Any suggestions on how to work around this? Has anyone used TagVisualizers in a similar scenario? If so, how did you solve this? By the way, the layers all work fine, since they will only steal events that are directly on top of their sub elements (the rest of the layer is invisible to hit testing)

    Read the article

< Previous Page | 150 151 152 153 154 155 156 157 158 159 160 161  | Next Page >