Search Results

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

Page 85/239 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Cannont Update control in WPF custom control

    - by Fazi
    I have created a custom control which holds a button in it. The button is styled, so as to hold a grid with two rows, an image in the first and a TextBlock in the second. I have written an Event Handler for the custom control. When the mouse enters the path of the object the MouseEnter event fires, where I try to change the TextBlock's FontSize and Foreground color, however the control does not update. In contrast, I have tried to modify an regular TextBlock's(not part a custom control and controltemplate) properties, and they update correctly, on the fly. What am I missing here?? Here is the code for the event handler: private void ThemeButton_MouseEnter(object sender, MouseEventArgs e) { InitializeProperties(); TextElement.FontSize = 16; TextElement.Text = "new text"; TextElement.Foreground = Brushes.Red; TextBlock element = MainWindow.FindChild<TextBlock>(MainWindow.StartWindow, "textField"); element.Text = "new text for regular textblock"; element.Foreground = Brushes.Red; } InitializeProperties is a methid that initializes TextElement(typeof TextBlock) and ImageElement(typeof Image) properties. They are not null. The properties are just regular .NET properties.

    Read the article

  • Wpf ItemsControl with datatemplate, problem with doubled border for some items

    - by ksirg
    Hi, I have simple ItemsControl with custom datatemplate, template contains only textblock with border. All items should be displayed vericaly one after another, but some items have extra border. How can I remove it? I want to achieve something similar to enso launcher, it looks like My implementation looks like this here is my xaml code: <Window x:Class="winmole.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" x:Name="hostWindow" Height="Auto" MinHeight="100" MinWidth="100" Width="Auto" Padding="10" AllowsTransparency="True" WindowStyle="None" Background="Transparent" Top="0" Left="0" SizeToContent="WidthAndHeight" Topmost="True" Loaded="Window_Loaded" KeyUp="Window_KeyUp" > <Window.Resources> <!--Simple data template for Items--> <DataTemplate x:Key="itemsTemplate"> <Border Background="Black" Opacity="0.9" HorizontalAlignment="Left" CornerRadius="0,2,2,0"> <TextBlock Text="{Binding Path=Title}" TextWrapping="Wrap" FontFamily="Georgia" FontSize="30" Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Stretch" TextAlignment="Left" Padding="5" Margin="0" Foreground="Yellow"/> </Border> </DataTemplate> </Window.Resources> <DockPanel> <ItemsControl DockPanel.Dock="Bottom" Name="itcPrompt" ItemsSource="{Binding ElementName=hostWindow, Path=DataItems}" ItemTemplate="{StaticResource itemsTemplate}" > <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Vertical" /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> </ItemsControl> </DockPanel>

    Read the article

  • WPF: Binding to ListBoxItem.IsSelected doesn't work for off-screen items

    - by Qwertie
    In my program I have a set of view-model objects to represent items in a ListBox (multi-select is allowed). The viewmodel has an IsSelected property that I would like to bind to the ListBox so that selection state is managed in the viewmodel rather than in the listbox itself. However, apparently the ListBox doesn't maintain bindings for most of the off-screen items, so in general the IsSelected property is not synchronized correctly. Here is some code that demonstrates the problem. First XAML: <StackPanel> <StackPanel Orientation="Horizontal"> <TextBlock>Number of selected items: </TextBlock> <TextBlock Text="{Binding NumItemsSelected}"/> </StackPanel> <ListBox ItemsSource="{Binding Items}" Height="200" SelectionMode="Extended"> <ListBox.ItemContainerStyle> <Style TargetType="{x:Type ListBoxItem}"> <Setter Property="IsSelected" Value="{Binding IsSelected}"/> </Style> </ListBox.ItemContainerStyle> </ListBox> <Button Name="TestSelectAll" Click="TestSelectAll_Click">Select all</Button> </StackPanel> C# Select All handler: private void TestSelectAll_Click(object sender, RoutedEventArgs e) { foreach (var item in _dataContext.Items) item.IsSelected = true; } C# viewmodel: public class TestItem : NPCHelper { TestDataContext _c; string _text; public TestItem(TestDataContext c, string text) { _c = c; _text = text; } public override string ToString() { return _text; } bool _isSelected; public bool IsSelected { get { return _isSelected; } set { _isSelected = value; FirePropertyChanged("IsSelected"); _c.FirePropertyChanged("NumItemsSelected"); } } } public class TestDataContext : NPCHelper { public TestDataContext() { for (int i = 0; i < 200; i++) _items.Add(new TestItem(this, i.ToString())); } ObservableCollection<TestItem> _items = new ObservableCollection<TestItem>(); public ObservableCollection<TestItem> Items { get { return _items; } } public int NumItemsSelected { get { return _items.Where(it => it.IsSelected).Count(); } } } public class NPCHelper : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void FirePropertyChanged(string prop) { if (PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(prop)); } } Two separate problems can be observed. If you click the first item and then press Shift+End, all 200 items should be selected; however, the heading reports that only 21 items are selected. If you click "Select all" then all items are indeed selected. If you then click an item in the ListBox you would expect the other 199 items to be deselected, but this does not happen. Instead, only the items that are on the screen (and a few others) are deselected. All 199 items will not be deselected unless you first scroll through the list from beginning to end (and even then, oddly enough, it doesn't work if you perform scrolling with the little scroll box). My questions are: Can someone explain precisely why this occurs? Can I avoid or work around the problem?

    Read the article

  • In WPF Not Able to Kill Adobe Acrobat Reader

    - by Blam
    Problem with killing Adobe Acrobat Reader Code used to launch the process nativeProcess = new Process(); nativeProcess.StartInfo.FileName = filePath; nativeProcess.Start(); These are Microsoft Office Files or Adobe Acrobat. Code used to kill if (nativeProcess != null) { try { nativeProcess.Kill(); } catch { } } if (nativeProcess != null) { try { nativeProcess = null; } catch { } } My problem is that Adobe Acrobat Reader does not Kill() when the app is running as a Citrix app. If I log on at the Citrix box and run it as a Desktop app then Acrobat Kill() works. Microsoft Office Kills() fine as both a Citrix app and a Deskop app. User can close Acrobat Reader using the X or close

    Read the article

  • wpf treeview does not show child objects

    - by gangt
    I have an object with child object(s) and I load it using linq. And I assign it to a treeView's itemssource. treeView.DisplayMemberPath = "Name"; treeView.ItemsSource = tasks; It shows only the parent nodes (task.name), I couldn't figure out how to add children (TaskItems.name). All the examples show HierarchicalData in xaml. I need to do it in code-behind, just like the above code. Is it possible? public class Task { public int Id; public string Name; public bool IsActive; public List<TaskItem> TaskItems = new List<TaskItem>(); } public class TaskItem { public int TaskId; public string Name; public string Value; } -------------- var tasks1 = from t in xd.Descendants("taskheader") select new Task { Id = (int)t.Element("id"), Name = t.Element("name").Value, IsActive = t.Element("isactive").Value == "1", TaskItems = t.Elements("taskdetail").Select(e => new TaskItem { TaskId = (int)e.Element("taskid"), Name = (string)e.Element("name"), Value = (string)e.Element("value"), }).ToList() }; -------------- List<Task> tasks = new List<Task>(); tasks = tasks1;

    Read the article

  • WPF datagrid live-update with button-column

    - by dlang
    Dear All! I have a datagrid which contains bid and ask - prices for currency-symbols. The data is updated every seconds. I update the data by creating a new collection of my viewmodel-entities and bind this collection to the datagrid every second. The problem is: Because my datagrid contains a template-column with a button "buy", this button is also recreated every second! This means, that when the user hovers the button, the hover-styles blinks, as the button is recreated every second. Additionally sometimes the click-event is not fired correctly, if the button is recreated while the user has his mouse-left-button pressed. Any suggestions, how to solve real-time-update a datagrid with button-columns?

    Read the article

  • WPF DataGrid populating blank rows on TreeView's SelectedItemChanged

    - by jes9582
    When my DataGrid populates on the TreeView's SelectedItemChanged event it finds the objects and creates the rows accordingly but the rows populate with no text or are just blank. So I know it is finding my objects but it is not displaying them properly. Does anyone see where I made an error or suggest any changes or fixes? Thank you in advance! Here is the CSharp code that is setting the DataGrid's ItemsSource (I am using .dbml and LINQ with Lambda expressions): dgSystemSettings.ItemsSource = (tvSystemConfiguration.SelectedItem as SYSTEM_SETTINGS_GROUP).SYSTEM_SETTINGS_NAMEs.Join(ssdc.SYSTEM_SETTINGS_VALUEs, x => x.SSN_ID, y => y.SSV_SSN_ID, (x, y) => new { SYSTEM_SETTINGS_NAME = x, SYSTEM_SETTINGS_VALUE = y }); And here is the .xaml: <DataGrid Name="dgSystemSettings" AutoGenerateColumns="False" Height="447" Width="513" DockPanel.Dock="Right" ItemsSource="{Binding}" VerticalAlignment="Top" Margin="10,10,0,0"> <DataGrid.Columns> <DataGridTextColumn x:Name="colDisplayName" Header="Name" Binding="{Binding SSN_DISPLAY_NAME}"></DataGridTextColumn> <DataGridTextColumn x:Name="colValue" Header="Value" Binding="{Binding SSV_VALUE}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid>

    Read the article

  • Can I enable PreviewClick using InputBindings in WPF?

    - by No hay Problema
    I want to detect when a user clicks on an item on a listview, without using events as I do command binding and I don't like all the nonsense of the behaviours. I have tried this: <ListView x:Name="MainList" Margin="2,8,6,8" Background="Black" ItemsSource="{Binding Path=AssetsVM.Data, Mode=OneWay}" BorderBrush="{x:Null}" > <ListView.InputBindings> <MouseBinding Command="{Binding Path=AssetsVM.SelectActivo}" CommandParameter="{Binding ElementName=MainList, Path=SelectedItem}" MouseAction="LeftClick" /> </ListView.InputBindings> This works fine if I click on the listview but does not work on the items, what I need is either a way to enable "Preview" or have a MouseAction/Gesture that behaves as preview, is it possible? Thanks

    Read the article

  • Problem with derived ControlTemplates in WPF

    - by Frank Fella
    The following xaml code works: <Window x:Class="DerivedTemplateBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DerivedTemplateBug" Title="Window1" Height="300" Width="300"> <Button> <Button.Template> <ControlTemplate> <Border BorderBrush="Black" BorderThickness="2"> <TextBlock>Testing!</TextBlock> </Border> </ControlTemplate> </Button.Template> </Button> </Window> Now, if you define the following data template: using System.Windows.Controls; namespace DerivedTemplateBug { public class DerivedTemplate : ControlTemplate { } } And then swap the ControlTemplate for the derived class: <Window x:Class="DerivedTemplateBug.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:DerivedTemplateBug" Title="Window1" Height="300" Width="300"> <Button> <Button.Template> <local:DerivedTemplate> <Border BorderBrush="Black" BorderThickness="2"> <TextBlock>Testing!</TextBlock> </Border> </local:DerivedTemplate> </Button.Template> </Button> </Window> You get the following error: Invalid ContentPropertyAttribute on type 'DerivedTemplateBug.DerivedTemplate', property 'Content' not found. Can anyone tell me why this is the case?

    Read the article

  • Binding Bitmapimge to Image in Wpf?

    - by Rev
    This is a simple Question (lets see) I want to bind bitmap image to Image. For doing this in cs code u must write this line. this.leftImage.Source = new BitmapImage(new Uri(@"C:\a.bmp")); But I want make Binding from resources. Because In release time resources became part of project.exe file and if you make binding from file(Mean set Image.source with Image file address), you must always put image file in the same address(disaster programing) :)

    Read the article

  • Implementing master-detail with 2 tables in a dataset (wpf)

    - by Dani
    I've created a dataset that contains 2 tables: Users (userID, UserName, other user details) Emails (Id, UserId, UserEmail) I populate the dataset using 2 DataAdapters (one for each table) I have a listbox, a few textboxes and a grid. listbox gets all the users, the few textboxs displays the user details when picked in the list box (this is easy b/c they are both bound to the same table). the grid should display the selected user's email addresses. How do I do it using binding ? is it possible or should I catch the selection change event and filter the grid "manually" (currently the grid displays all the emails in the tables).

    Read the article

  • Examples of fast .NET WPF/WinForms apps?

    - by mythz
    I am currently investigating whether to build a windows application using unmanaged C/C++ or in .NET and would like to know of the kind of performance and responsiveness that is capable with a managed C#/.NET GUI app? Not surprisingly it looks like the fastest most responsive applications (e.g. chrome, spotify, etc) are written in unmanaged C/C++. I've had a hard time finding examples of really good .NET applications and so I would like some help. What's the best example of a fast and responsive .NET windows application?

    Read the article

  • Making a moveable control in WPF

    - by Dave Colwell
    Hi guys, I have a panel, within that panel are several rectangular controls (the number of controls vaires) I want the user to be able to move the controls around within the panel so that they can arrange the controls in the way that suits them best. does anyone have any resources i could read or simple tips which would get me headed down the right road?

    Read the article

  • 75 to 100% of CPU Usage in WPF?

    - by Khan
    Hi, Whenever application loads and any other usercontrol loads in the application, while loading and rendering the cpu usage touches 80 - 100%. How should i resolve this? Thanks and regards, Ershad

    Read the article

  • WPF: Cannot set properties on property elements weirdness...

    - by Willy
    private TextBlock _caption = new TextBlock(); public TextBlock Caption { get { return _caption; } set { _caption = value; } } <l:CustomPanel> <l:CustomPanel.Caption Text="Caption text" FontSize="18" Foreground="White" /> </l:CustomPanel> Gives me the following error: Cannot set properties on property elements. If I use: <l:CustomPanel> <l:CustomPanel.Caption> <TextBlock Text="Caption text" FontSize="18" Foreground="White" /> </l:CustomPanel.Caption> </l:CustomPanel> My TextBlock shows up fine but it's nested inside another TextBlock like so, it even seems to add itself outside of the Caption property: <l:CustomPanel> <l:CustomPanel.Caption> <TextBlock> <InlineUIContainer> <TextBlock Text="Caption text" FontSize="18" Foreground="White" /> </InlineUIContainer> </TextBlock> </l:CustomPanel.Caption> <TextBlock> <InlineUIContainer> <TextBlock Text="Caption text" FontSize="18" Foreground="White" /> </InlineUIContainer> </TextBlock> </l:CustomPanel> As you might have already guessed, what i'd like my code to do is to set my Caption property from XAML on a custom panel, if this is possible. I've also tried the same code with a DependencyProperty to no avail. So, anyone that can help me with this problem?

    Read the article

  • Column Header Styling Issue in Data Grid in WPF

    - by sbrakl
    I have formated the Wcf Toolkit Datagrid and below in the is the ColumnHeader Style for it But, there are still some area in Column Header, which are not styled as shown in the image http://www.freeimagehosting.net/uploads/9aba4fbd93.jpg <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type dg:DataGridColumnHeader}"> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="Background" Value="Orange" /> <Setter Property="Foreground" Value="White" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="dg:DataGridColumnHeader"> <dg:DataGridHeaderBorder x:Name="headerBorder" Background="Orange"> <Border BorderThickness="2" CornerRadius="5" Background="Orange" BorderBrush="DarkOrange"> <Grid> <TextBlock Text="{TemplateBinding Content}" VerticalAlignment="Center" HorizontalAlignment="Center" TextWrapping="Wrap"/> </Grid> </Border> </dg:DataGridHeaderBorder> </ControlTemplate> </Setter.Value> </Setter> </Style> <dg:DataGrid Grid.Row="1" Grid.RowSpan="1" Name="dgQuestion" HorizontalAlignment="Left" AutoGenerateColumns="True" Width="740" MinWidth="200" MaxWidth="740" Background="Wheat" ColumnHeaderHeight="30" ColumnHeaderStyle="{DynamicResource ColumnHeaderStyle}" RowStyle="{StaticResource RowStyle}" CanUserAddRows="False" CanUserDeleteRows="False" AlternationCount="2"/>

    Read the article

  • WPF combo box, adding an all options item, when binding to an Observable Collection

    - by Joel Barsotti
    So I've got an object that has an observable collection. Most places I bind to this collection I only want the user to select a single item. But in one place I want the combobox to include an all items option. Is the way to do this simply with xaml converter? It seems like doing it in the view model would be a good idea, but it's really a lot dependency object goop to basically wire up an collection that is two objects deep for an on change event, where as the xaml converter just works. But I always feel like xaml converters should be generic and reusable, where in this instance, the xaml converter would be more of a one off. Of course the third option would be to create one off list for UI in the object that contains the standard observable collection. But this seems to be mixing the logic and presentation in a way that makes me uncomfortable.

    Read the article

  • WPF DrawingVisual from my own class

    - by Robbskinizer
    Hi, Im trying to create my own class which contains a DrawingVisual, something like this public class MyObject { public DrawingVisual visual; public bool faceup; public bool flipped; } I have a drag and drop from a listview to a canvas, but when I try to get the object which back from the Canvas i only get the visual, not any of the other stuff in the class. How do i save "objects" and retreive it from a canvas? Im using my own MyCanvas which inheritance from Canvas, and using the AddVisualChild & AddLogicalChild etc. // Robbin

    Read the article

  • List<string> doesn't update the UI when change occurs [WPF]

    - by Hard Turner
    <ListBox x:Name="MainList" HorizontalAlignment="Left" Height="468" Margin="10,10,0,0" VerticalAlignment="Top" Width="100" ItemsSource="{Binding Items,Mode=TwoWay}" DisplayMemberPath="Name"/> [Serializable()] public class MYcontainer : INotifyPropertyChanged,ISerializable { private List<MYClass> _items = new List<MYClass>(); public List<MYClass> Items { get{ return _items;} set { this._items =value; OnPropertyChanged("Items"); } public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string propertyName = null) { var eventHandler = this.PropertyChanged; if (eventHandler != null) eventHandler(this, new PropertyChangedEventArgs(propertyName)); } } when i add an item to "Items" the UI doesnt update, the binding is working fine, since if i closed the window and opened it again, the new items appear correctly what am i doing wrong? i know if i used observablecollection it will work fine, but shouldn't it work with List<? , i already have in another window a string[] property and it update fine

    Read the article

  • Binding Combobox to XML (wpf)

    - by mortor
    <EssenceList> <Essence GUID="464"> <Properties> <Property Name="Name"> <value>mt-1232-1. (1-1-3)</value> </Property> </Properties> <Characteristics> <Characteristic GUID="78"> <value>gadget</value> </Characteristic> <Characteristic GUID="79"> <value>measures</value> </Characteristic> </Characteristics> <LinkedEssences> <LinkType Type="ObjGroup"> <LinkedEssence GUID="369" /> </LinkType> <LinkType Type="ObjGroupProp" /> <LinkType Type="RoleObject"> <LinkedEssence GUID="5747"/> </LinkType> </LinkedEssences> </Essence> ... <Essence GUID="5747" Type="Role"> <Properties> <Property Name="Name"> <value>????-22</value> </Property> <Property Name="ShortName"> <value>UKPG-22</value> </Property> <Property Name="TagPrefix"> <value>UKPG22</value> </Property> <Property Name="useParentTagPrefix"> <value>0</value> </Property> </Properties> </Essence> ... <Essence GUID="5748" Type="Role"> </Essence> ... in example is a xml file with data from database. now i need to bind it to some fields... i use the XMLDataProvider here <Grid.DataContext> <XmlDataProvider x:Name="dataxml" XPath="EssenceList/Essence" Source="464.xml"/> </Grid.DataContext> and mostof simple texboxes i bind like <TextBox Text="{Binding XPath=/EssenceList/Essence/LinkedEssences/LinkType[1]/LinkedEssence/@GUID}" /> but now i need to bind a combobox this way: - the first Essence in the document contains LinkedEssences, that contains and - in document below there is a full description for it that contains the NAME property i need ????-22 UKPG22 0 and many other available Essences for this combobox i managed to bind the list of thems to combobox <ComboBox ItemTemplate="{StaticResource rolelistTemplate}" ItemsSource="{Binding XPath=/EssenceList/Essence[@Type]}" /> so it displays it well, but i can't bind it to my LinkedEssences.

    Read the article

  • Image Source In ControlTemplate WPF

    - by Asim Sajjad
    I have a ControlTemplate which is for the Button control, in the ControlTemplate I have Image control which is used to displayed in the button, Now I want to set the Image Source at runt time as I have to copy paste the ControlTemplate for each of the button to set new image for new button. Thanks in advance.

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >