Search Results

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

Page 112/239 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • ScrollViewer in a ListBox not working. WPF.

    - by guest
    Hi, I have the following defined in my control: <local:TestListBox.ItemTemplate> <DataTemplate> <Border x:Name="eventBorder" Width="{Binding ElementName=eventsLbx, Path=ActualWidth,BorderBrush="{Binding Color}" BorderThickness="1" CornerRadius="4"> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientStop x:Name="StartGradient" Color="#FFFFFFFF" Offset="0"/> <GradientStop x:Name="EndGradient" Color="{Binding Color}" Offset="1"/> </LinearGradientBrush> </Border.Background> <Border.ToolTip> <ToolTip Content="{Binding Text}"/> </Border.ToolTip> <TextBlock TextTrimming="CharacterEllipsis" HorizontalAlignment="Center" FontSize="12" Text="{Binding Text}" /> </Border> <DataTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter TargetName="eventBorder" Property="Background" Value="#FFE4EBF5"/> </Trigger> </DataTemplate.Triggers> --> </DataTemplate> </local:TestListBox.ItemTemplate> </local:TestListBox> </ScrollViewer.Content> </ScrollViewer> </Grid> <ControlTemplate.Triggers> <Trigger SourceName="eventsLbx" Property="HasItems" Value="False"> <Setter TargetName="eventsLbx" Property="Visibility" Value="Hidden"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> Now if there are more items than are visible, then the scrollviewer appears properly but the user CANNOT drag the scrollviewer middle button for scrolling. The user can click on the arrows at the end of the scrollviewer to scroll but he cannot click the bar that appears on the scrollbar and drag it to actually scroll the contents. I cannot figure out why this is happening...

    Read the article

  • How to restrict special symbols like % in textbox in wpf?

    - by Vamsy
    I would like to develop a textbox which restricts special symbols like %. I used textbox's keydown event to restrict '%' . I already used the code as if(Keyboard.Modifiers == ModifierKeys.Shift && e.key == key.D5) { e.handle=true; return; } when i implement this in mvvm architecture, I got problem with the dependency property that recognizes only shift as one key and D5 as another when I converted systemkey into string format. How can I recognize % symbol?

    Read the article

  • Drag and drop between ListBox items and Grid cells in WPF?

    - by AJ
    Hi There is a list box with some items in it. Also there is a grid with 3x3 matrix. The user will be dragging an item and dropping on one the cells of grid. Most of the samples I found are about dragging-dropping from one listbox to another listbox. But I want to drop in one cell of grid. How can I achieve this? Please advise. thanks PJ

    Read the article

  • WPF Binding to IDictionary<int,MyType>.Values Doesn't Respond to Property Changes?

    - by Phil Sandler
    I am binding a ListView a property that essentially wraps the Values collection (ICollection) on a generic dictionary. When the values in the dictionary change, I call OnNotifyPropertyChanged(property). I don't see the updates on the screen, with no binding errors. When I change the property getter to return the Linq extension dictionary.Values.ToList(), without changing the signature of the property (ICollection) it works with no problem. Any reason why the Values collection bind and notify properly without projecting to an IList<?

    Read the article

  • Simplest way to create a wrapper class around some strings for a WPF DataGrid?

    - by Joel
    I'm building a simple hex editor in C#, and I've decided to use each cell in a DataGrid to display a byte*. I know that DataGrid will take a list and display each object in the list as a row, and each of that object's properties as columns. I want to display rows of 16 bytes each, which will require a wrapper with 16 string properties. While doable, it's not the most elegant solution. Is there an easier way? I've already tried creating a wrapper around a public string array of size 16, but that doesn't seem to work. Thanks *The rational for this is that I can have spaces between each byte without having to strip them all out when I want to save my edited file. Also it seems like it'll be easier to label the rows and columns.

    Read the article

  • WPF layout calls MeasureOverride repeatedly in increments of 2?

    - by Scott Whitlock
    I've run into a case where I have a custom Panel (inherits from Panel) and I'm using it as an ItemsPanel in a ListView. When I resize the container that it's in, if I resize it smaller, my panel's MeasureOverride function gets called once, but if I resize it larger (let's say from 100 to 300), it calls MeasureOverride and ArrangeOverride for every value between 100 and 300, in increments of 2 (so 102, 104, etc.). The weird thing is that the container resizes right away (its size gets to 300 immediately). It doesn't seem to matter what I return from MeasureOverride - it just does this. I wish I could make it happen in a really small application and post it here, but I haven't been able to reproduce it like that yet. I can reproduce it all day in my app though. Does anyone know what could cause this?

    Read the article

  • WPF List of ViewModels bound to list of Model objects.

    - by Eric
    In the model, I have: public ObservableCollection<Item> Items { get; private set; } In the ViewModel, I have a corresponding list of ItemViewModels: public ObservableCollection<ItemViewModel> ItemViewModels ... In the XAML, I will bind (in this case a TreeView) to the ItemViewModels property. My question is, what goes in the "..." in the ViewModel shown above? I am hoping for a line or two of code to binds these two ObservableCollections (providing the type of the ViewModel to construct for each model object). However, what I'm fearing is necessary is a bunch of code to handle the Items.CollectionChanged event and manually updates the ItemViewModels list by constructing ViewModels as necessary. Thanks! Eric

    Read the article

  • How to create a separate thread to do some operation periodically and update UI in WPF?I'm stack

    - by black sensei
    Hello Experts! I'm trying to do a periodic separated thread operation let's say check for internet connection or check for user's info via web service and update the user interface. i've tried with quartz.net to implement that.So i created an inner class for the window i need to update.That inner class does what is meant for but the problem is that i don't know how to access parent's(window class) members form the child(inner class). for example public partial class Window2 : Window { private int i; public Window2() { InitializeComponent(); } public string doMyOperation() { //code here return result; } public class Myclass :IJob { public void Execute(JobExecutionContext context) { string result = doMyOperation(); //Now here i could be able to call a label of name lblNotif //lblNotif.Content = result; } } } Well the whole idea works but i'm stacked at here i need to access a controls of Window2 Since i'm stacked i tried Spring.Net way of implementing Quartz hoping that i could use MethodInvokingJobDetailFactoryObject and rather have the Operation done on Window2 itself.But for some reason i'm having an exception Cannot resolve type [System.Windows.Window2,System.Windows];, could not load type from string value System.Windows.Window2,System.Windows and the wiring is done so <object name="UpdateLabelJob" type="System.Windows.Window2,System.Windows"/> What i'm i doing wrong here?Is that a way round? thanks for reading and for helping out

    Read the article

  • How to resize a group of vectors in Expression Blend/WPF/Silverlight ?

    - by Shnitzel
    So say for example I created a few small squares in expression blend. I then group them together by selecting them, right clicking and selecting "Group Into - Grid" So now that they are in the grid, I'd like to be able to resize this grid and then they would resize but it doesn't happen, it just resizes the grid but leaves the vectors the same. Is there a way to do what I am looking for? p.s I know you can just select all the vectors and then resize them all, but I am looking for a way to just resize one container and not all the objects in there..

    Read the article

  • How do you compose DataTemplates / link to a child datatemplate in WPF?

    - by Gishu
    Here's the problem. Given a large/intricate datatemplate A, which has 3 sections - General, Properties, Misc. Imagine 3 grids for each. Now I need to reuse the Properties section of the above Datatemplate in another place. Reasons: To avoid redundancy + ensure that further updates to the datatemplate are applied identically to all usages. So I guess what I am asking for is an ability to slot in a link to a child DataTemplate in a parent Datatemplate. What's the best way to go about this ? I found one way to do this.. but I'm not sure if its the right way or the best.. Posting it as an answer below so that it can be rated.

    Read the article

  • How do you open a second WPF window without creating a new one.

    - by Daniel
    In the program I am trying to build, I have a menu button that opens a second window. The user puts information into the second window, presses the "Done" button, and the information is transfered into the main window. The problem I am having is opening the second window. I have both windows build in xaml files in Visual Studio but I can't find a way to show the second window. Using "Window window = new Window" does not fit my needs because 1) I already have the second window built and 2) I have tried this and I cannot figure out how to add children to the window; there is no window.children nor any grid to put the children into. Thank you in advance!

    Read the article

  • How do you calculate the offset to the client area in WPF?

    - by chris
    I want to position a modal dialog (progress window) at the top right corner of the parent window client area. This code will put it in the corner of the non-client area, but how do I calculate the offset to the client area? this.Owner=owner; this.Left=owner.Left+owner.ActualWidth-Width; this.Top=owner.Top; Edit: I found this 'solution' that works for normal windows: this.Left=owner.Left+owner.ActualWidth-Width-SystemParameters.ResizeFrameVerticalBorderWidth; this.Top=owner.Top+SystemParameters.ResizeFrameHorizontalBorderHeight+SystemParameters.WindowCaptionHeight; This would however fail for windows that have customized borders. EDIT: The code should work regardless of the systems DPI setting (e.g. 120 instead of 96).

    Read the article

  • WPF/XAML - compare the "SelectedIndex" of two comboboxes (DataTrigger?)

    - by Luaca
    hello, i've got two comboboxes with the same content. the user should not be allowed to choose the same item twice. therefore the comboboxes' contents (= selectedindex?) should never be equal. my first attempt was to comapare the selectedindex with a datatrigger to show/hide a button: <DataTrigger Binding="{Binding ElementName=comboBox1, Path=SelectedIndex}" Value="{Binding ElementName=comboBox2, Path=SelectedIndex}"> <Setter Property="Visibility" Value="Hidden" /> </DataTrigger> it seems that it is not possible to use Value={Binding}. is there any other way (if possible without using a converter)? thanks in advance!

    Read the article

  • Why does the BackgroundWorker in WPF need Thread.Sleep to update UI controls?

    - by user364060
    namespace WpfApplication1 { /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { BackgroundWorker bgWorker; Action<int> myProgressReporter; public Window1() { InitializeComponent(); bgWorker = new BackgroundWorker(); bgWorker.DoWork += bgWorker_Task; bgWorker.RunWorkerCompleted += myWorker_RunWorkerCompleted; // hook event to method bgWorker.ProgressChanged += bgWorker_ReportProgress; // hook the delegate to the method myProgressReporter = updateProgress; bgWorker.WorkerReportsProgress = true; } private void myWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) { object result; result = e.Result; MessageBox.Show(result.ToString()); progressBar1.Value = 0; button1.IsEnabled = true; } private void bgWorker_ReportProgress(object sender, ProgressChangedEventArgs e) { System.Windows.Threading.Dispatcher disp = button1.Dispatcher; disp.BeginInvoke(myProgressReporter,e.ProgressPercentage); //Dispatcher.BeginInvoke(myProgressReporter, DispatcherPriority.Normal, e.ProgressPercentage); } private void updateProgress(int progressPercentage) { progressBar1.Value = progressPercentage; } private void bgWorker_Task(Object sender, DoWorkEventArgs e) { int total = 1000; for (int i = 1; i <= total; i++) { if (bgWorker.WorkerReportsProgress) { int p = (int)(((float)i / (float)total) * 100); bgWorker.ReportProgress(p); } Thread.Sleep(1); // Without Thread.Sleep(x) the main thread freezes or gives stackoverflow exception, } e.Result = "Completed"; } private void button1_Click(object sender, RoutedEventArgs e) { if(!bgWorker.IsBusy) bgWorker.RunWorkerAsync("This is a background process"); button1.IsEnabled = false; } } }

    Read the article

  • Preview of code-only WPF controls in VS2010 - how?

    - by Christian
    Hi, I hope I am able to illustrate the problem using a lot of images. First of all, I was no real fan of XAML (Silverlight issues, crashes in Preview, and so on...) Now, with VS2010 the situation has become better. There are still a lot of things I like better in code, but I also want a preview in my VS. So, take a look at the following control: It is really simple, a todo details list. The first screenshot shows the code of the control, pretty straighforward: There is no XAML, so obviously no preview. Of course, I could encapsulate it in another control, like shown in the next screenshot: But, in that case I have an additional file I do not want or need. So I had the idea to move the init stuff inside the contructor of a XAML control. For simplicity, I used simple elements. But they do not show up in the preview... Finally, I know I could use the controls in other parts of my app when creating UIs. But I am using layout manager, PRISM and a lot of other stuff, so I just want an easy preview of some specific control I created (without having to have a XAML wrapper file for each control) Thanks for help, and sorry for the post structure, but I though with images it is better to understand... Chris

    Read the article

  • In WPF XAML how can I concatenate 2 constants so I can use pre-define paths?

    - by toaster24
    I'm new to XAML, so presume I'm missing something simple. I want to replace the path part of the source path with a c# constant for easier path management, for example I have: <Image Source="/Images/Themes/Buttons/MyPicture.png" /> and in another class I have my constant defined: public static readonly string UriImagesButtons = "/Images/Big/PNG/"; I want to have something along the lines of: <Image Source="{static:UriImagesButtons + MyPicture.png}" /> This means that I can change the path globally at a stroke if the need arises. What's the syntax to do this?

    Read the article

  • WPF: how to make normal listbox left-drag-select behavior use middle mouse instead?

    - by Scott Bilas
    I'm building a special listbox control that our designers want customized in some tweaky ways. One thing they want to see is that the middle button-drag does what the left button-drag normally does (we are repurposing left-drag to other things). So it needs the two key features that left-drag does in a ListBox default implementation: While holding down the button and dragging, the selection starts where I click down and extends to where I drag. While dragging outside the listbox region, it scrolls if there is scrollable space in that direction. Before I go an duplicate this functionality by hand, is there any easy way to fool ListBox into thinking it's getting left-mouse drag events but instead is getting middle-mouse?

    Read the article

  • How can I incorporate a data bound list of MenuItems to another MenuItem in WPF?

    - by Julien Poulin
    I have a 'File' MenuItem were I would like to display a list of recently opened files. Here is the xaml I have now: <MenuItem Header="File}"> <MenuItem Header="Preferences..." Command="{Binding ShowOptionsViewCommand}" /> <Separator /> <ItemsControl ItemsSource="{Binding RecentFiles}"> <ItemsControl.ItemTemplate> <DataTemplate> <MenuItem Header="{Binding DisplayPath}" CommandParameter="{Binding}" Command="{Binding Path=DataContext.OpenRecentFileCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Window}}}"> </MenuItem> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> <Separator /> <MenuItem Header="Exit" Command="{Binding CloseCommand}" /> </MenuItem> However, when I use this code, there is a weird offset around the MenuItems and it looks like there is a container around them. How can I get rid of that? Here is a screenshot of what it looks like:

    Read the article

  • WPF Datatemplate + ItemsControl each item uses > 1 MB Memory?

    - by Matt H.
    Does that sound right to anyone???? I have an ItemsControl that displays data from a custom object that implements iNotifyPropertyChanged. The DataTemplate consists of: Border 3 buttons 5 textboxes An ellipse A Bindable RichTextBox (custom class that inherits from RichTextBox... so I could make Document a dependency property (to support binding)) Several grids and stackpanels for layout It uses: Styles (stored in a resource dictionary higher up the tree) Styles affect: colors, thicknesses, and text properties: which are data-bound to a "settings" class that implements iNotifyPropertyChanged, so the user can change display settings That's it! So what gives? I've also noticed that when I empty and remove the ItemsControl, memory isn't freed. over 5000 instances of "CommandBindingCollection" and "WeakReference" are CREATED (using ANTS profiler). And huge number of EffectiveValueEntry objects are created too. So really, what gives!!! :-) Thanks for your insight! Management needs this project soon but in its current state, it's unreleasable.

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >