Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

artwallacex

@artwallacex
About
Posts
21
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • What is killing all WPF command CanExecutes?
    A artwallacex

    Yes, the app was made with the Wpf template. Here's the SetUiAsBusy method:

    private void SetUiAsBusy()
    {
    MasterList.UiIsFree = false;
    NotifyPropertyChanged_All();
    CommandManager.InvalidateRequerySuggested();
    }

    The SetUiAsFree method is the same except it is set to true. The UiIsFree variable is bound to the IsEnabled property of many UI elements. In the method I posted earlier, MasterList.RemoveDirTreeNodeAndChildren(theDirTreeNodeToRemove, true); is where nearly everything happens. Several ObservableCollections are modified (safely as best as I can tell) that are bound to UI elements. No exceptions are getting swallowed and the VS output pane remains empty while the method runs.

    WPF help question csharp wpf design

  • What is killing all WPF command CanExecutes?
    A artwallacex

    RNEELY, thanks for your reply. I will try to reproduce this in a sample app after I finish moving most of the code out of the window class and into the MasterList class. For the time being the entire source for the application is available: http://sourceforge.net/projects/subhub/[^] In my testing so far, the closest I have come to narrowing down the problem is in the following code block involving a MessageBox:

    private void Cmd_CloseDir_Executed(object sender, ExecutedRoutedEventArgs e)
    {
    SetUiAsBusy();
    if (MessageBox.Show(this, "Do you really...", "Confirm close", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
    {
    DirTreeNode theDirTreeNodeToRemove = MainTree_GetSelectedDirTreeNode();
    MasterList.RemoveDirTreeNodeAndChildren(theDirTreeNodeToRemove, true);
    MasterList.FillUniqueLists();
    MasterList.FileMatches.Clear();
    }
    SetUiAsFree();
    }

    When the method is run, if you select Yes from the MessageBox the problem will surface. If you select No then it will not. If I comment out the if (MessageBox.Show statement and just let the code run then the problem WILL NOT show up. From what I can tell, the problem seems to show up when dialogs and background processes are involved. I'll work to reproduce this in a sample this weekend.

    WPF help question csharp wpf design

  • What is killing all WPF command CanExecutes?
    A artwallacex

    I've encountered a strange problem in my WPF app. Basically, something appears to be killing all of my Command CanExecute methods. Every UI element that has a Command tied to it will be disabled after certain operations, while most other times they will function normally. Calling a dialog such as MessageBox.Show("Really?", MessageBoxButton.YesNo) then executing my code will cause the problem. Even UI elements with the most simple CanExecute such as this will be disabled after the dialog is shown.

    private void Cmd_Exit_CanExecute(object sender, CanExecuteRoutedEventArgs e)
    {
    e.CanExecute = true;
    }

    Adding CommandManager.InvalidateRequerySuggested(); into the methods does not help. Once they get disabled, clicking something active in the window will return normal behavior. I've exhausted all of the things that I know of to try to find out what is causing this problem. Where should I go from here? I feel that it's something in the bindings that is the problem but bringing up the debugger causes the behavior to change.

    WPF help question csharp wpf design

  • Binding TextBlock to styled text in code?
    A artwallacex

    How do I bind to Inlines? According to the docs it seems to be read-only. Do I need to switch to a Label or Textbox?

    WCF and WF wpf csharp wcf question

  • Binding TextBlock to styled text in code?
    A artwallacex

    I want to duplicate this XAML code but I want to dynamically create the text in C#.

    <TextBlock>
    <Run Background="Blue">Text1</Run>
    <Run Background="Red">Text2</Run>
    </TextBlock>

    How are the Runs added to the TextBox?

    WCF and WF wpf csharp wcf question

  • Binding to non-static collection?
    A artwallacex

    I have a simple question that I hope someone can help me with. All of the Wpf examples that I have seen which bind a ListView to a collection do so by declaring the collection as static. How do you accomplish this with a non-static collection? Here is the typical example that I have run across:

    public partial class Window1: Window
    {
    public static ObservableCollection TheCollection = new ObservaleCollection();

    public Window1()
    {
        InitializeComponent();
    }
    

    }

    The XAML file:

    <Window.Resources>
    <CollectionViewSource Source="{Binding Source={x:Static local:Window1.TheCollection}}" x:Key="TheCollectionView"/>
    </Window.Resources>
    <Grid>
    <ListView Name="TheCollectionListView" ItemsSource="{Binding Source={StaticResource TheCollectionView}}" />
    </Grid>

    What is the syntax for the binding when the ObservableCollection is not static? I hate to ask what seems to be such a basic question but after several hours of searching I cannot find any example that does not use static.

    WPF wpf question csharp css wcf

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    Karl, I have another question now. Based on editing one subitem, I need to change a value in another subitem. The change is working but the other subitem is not reflecting it's new value in the list. I've implemented INotifyPropertyChanged on both the Item and Subitem classes but am unsure how to tell Wpf that other items in the list need to updated. Nevermind, I think I've found the problem. I really need to get into those dependency properties because this INotifyPropertyChanged is turning into spaghetti.

    modified on Thursday, May 1, 2008 6:12 PM

    WPF question csharp wpf help

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    OK, thanks. I'll give that sample a look and read up more about dependency properties.

    WPF question csharp wpf help

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    Thanks, that's working. I guess I misunderstood how this process worked. I thought you informed the system of what changed then it would automagically know that the whole object had changed and needed to be updated. But the way it actually seems to work looks like there are plenty of ways for bugs to creep in. For instance, in my real project, the property IsModified will have to be notified from every field that can be changed. Are there any solutions to just hardcoding a bunch of these NotifyPropertyChanged in every editable field?

    WPF question csharp wpf help

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    Karl, the entire project (only like 6 major files) is online here: http://subhub.svn.sourceforge.net/viewvc/subhub/trunk/SubHubWpf/[^] I've also created a test project that is extremely lean that reproduces the problem. It's here: http://www.crankedup.com/misc/wpf-databinding-calcupdate.zip[^]

    WPF question csharp wpf help

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    I've tried doing that but nothing has changed. I used the example from INotifyPropertyChanged on MSDN for a template. Here is a snippet of my code: public class SubtitleItem : IComparable, INotifyPropertyChanged { private TimeSpan _TimeCodeStart; public TimeSpan TimeCodeStart { get { return _TimeCodeStart; } set { if (_TimeCodeStart != value) { _TimeCodeStart = value; NotifyPropertyChanged("TimeCodeStart"); } } } private TimeSpan _TimeCodeEnd; public TimeSpan TimeCodeEnd { get { return _TimeCodeEnd; } set { if (_TimeCodeEnd != value) { _TimeCodeEnd = value; NotifyPropertyChanged("TimeCodeEnd"); } } } public TimeSpan TimeCodeDuration { get { return TimeCodeEnd - TimeCodeStart; } } public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged(String info) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(info)); } } } What am I missing?

    modified on Wednesday, April 30, 2008 7:00 PM

    WPF question csharp wpf help

  • Properly display dynamic calculations in databinding? [modified]
    A artwallacex

    I'm wondering if someone can help me understand the proper way to do this in Wpf databinding. I have an object with start and end time properties that are displayed in a listview and can be edited in a bound detail area of the form. The edited values are immediately visible in the list after being edited. The object also has a duration property that looks like this: public TimeSpan Duration { get { return End - Start; } } But the duration will continue to display its original value in the databound listview after the start or end times have been edited. What is the proper way to deal with this situation? How do you get calculated values to show changes in real time? Thanks, Art

    modified on Wednesday, April 30, 2008 6:25 PM

    WPF question csharp wpf help

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    Heh, it was funny that you posted your TreeView article at the beginning of this thread. It was through that article that I read your mentoring article, which was what got me trying to nail down the problem in this sample application (mentorees "Do your own homework"/"forces you to study and carefully review your topic")! It's a small world.

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    Doh, very good catch. Unfortunately my real project is using an ObservableCollection with the proper using statements. The List<> is something I forgot or either experimented with in my sample project. So the sample project now works correctly so I'm back to hunting in my code. Thanks for your help Karl. Edit- My real project has the same problem. The collection bound to the list is an ObservableCollection but the children are just Lists, like in the sample. So double thanks Karl, you were spot on.

    modified on Thursday, April 3, 2008 1:49 PM

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    Yes, I know. But I've yet to see anything that suggests it shouldn't work the other way. To me it looks like a bug in the TreeView.

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    Sure, here's the solution in a 100k zip file. http://www.crankedup.com/misc/wpf-treeview-notriangle.zip[^] When you launch it, press the "Fake" button. It now calls this code: TreeNode tn1 = new TreeNode("1"); TreeNode tn2 = new TreeNode("2"); TreeNode tn3 = new TreeNode("3"); TreeNode tn4 = new TreeNode("4"); TreeNode tn5 = new TreeNode("5"); TreeNodeList.Add(tn1); tn1.Children.Add(tn2); tn1.Children.Add(tn3); tn2.Children.Add(tn4); tn2.Children.Add(tn5); And produces this screenshot (I've expanded all the nodes in the shot): http://www.crankedup.com/misc/wpf-treeview-notriangle3.png[^] PS- Thanks for taking a little time to look at this.

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    So you're saying that the databinding is not supposed to take care of that? The child nodes must be added before the parent item is added to the list? And again, running this code: TreeNodeList.Add(tn1); // Produces item with no expander! tn1.Children.Add(tn2); tn1.Children.Add(tn3); without the 2nd Add will still show all of the child elements, just without the expander. Double clicking the parent item will draw the child elements and the parent & children will produce events just like the others in the list.

    modified on Thursday, April 3, 2008 12:27 PM

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    But there are two child treenodes created by: tn1.Children.Add(tn2); tn1.Children.Add(tn3); They show up in the UI and if you doubleclick on the parent they will be displayed. The problem is the collapser is not drawn but the child elements are there.

    WPF wpf help question csharp wcf

  • Is WPF TreeView binding supposed to work like this (no collapse triangle)? [modified]
    A artwallacex

    Karl, that example is lazing loading a filesystem view into a treeview which is the opposite of what I'm doing. This is more a question about the treeview expander/collapser than about the task shown in the screenshots. Please take another quick look at this code, ignoring the C:\. TreeNode tn1 = new TreeNode(@"C:\"); TreeNode tn2 = new TreeNode(@"C:\"); TreeNode tn3 = new TreeNode(@"C:\"); TreeNodeList.Add(tn1); // Produces item with no expander! tn1.Children.Add(tn2); tn1.Children.Add(tn3); TreeNodeList.Add(tn1); // Works fine The first Add(tn1) produces an item with no expander. The 2nd does.

    WPF wpf help question csharp wcf

  • Table like control to set width in percentages
    A artwallacex

    Would a UniformGrid work for you there?

    WPF csharp css wpf data-structures tutorial
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups