|
Yes, it is a bool, but I need the inverse of what BooleanToVisibility (if the bool is true, I want Visibility.Collapsed ) provides, so I rolled my own. Beyond that, I have another property that I'm trying to set that's exhibiting the same issue, and it converts from a bool to a color.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Ah, okay. So I take it that the converter isn't firing then.
|
|
|
|
|
At this point, apparently not. :/
The properties in question are read-only because they simply evaluate the contents of another object, so RaisePropertyChanged wasn't getting called. I added some functionality to call RaisePropertyChanged, but that didn't have any affect.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I tried adding some properties that did the work of the converters, and these properties are getting called (and returning the expected values, but the treeview items aren't changing...
Is it too soon to expound on my general distaste for WPF?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Hmmm. It sounds as though it's picking the "wrong" DataContext.
|
|
|
|
|
I think I have to re-examine my treeviewitem style. I think the triggers are overriding my intent.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Do you want to send it to my email address? I'll have a quick look if you like.
|
|
|
|
|
Let me bang on it some more today (I'm going to look at the triggers), and if I still end up being blocked, I'll let you know. And if I finger it out, I'll let you know.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Try substituting TreeViewItem for TreeView in the FindAncestor lookup. See if that gets the right instance?
|
|
|
|
|
I tried that yesterday (before changing to use properties instead of converters, but I'll try it again.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Well, I spent the morning creating a test app similar in architecture to the app I'm working on. I think this will make it easier to screw up.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I fingered out what I was doing wrong. While creating the little sample app, I realized that since we're not data binding the tree, the DataContext for the tree (and its items) was NOT being set. We are creating each TreeViewItem individually, and as I was adding the code that did that, I wondered what would happen if I set the DataContext property to the object the item was representing.
When I set that, the tree lit up like a freakin' Christmas tree. I think I got a bit of a woody as a result (but I'm still not fond of WPF)...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
New Wrinkle...
So I transferred the new code to the actual project, and it still refused to work. The only difference between the actual project and my little sample app is that the TreeViewItem style was implemented inside the Window.xaml file in the sample app, but was in a ResourceDictionary in the application. I moved the style xaml to the actual control that contained the TreeView , did a clean/rebuild all, and it worked.
What an overly obscure pain in the ass...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
how to create slide menu in wpf?
|
|
|
|
|
I asked Google your question, and got these[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Dear Sir/Madam,
I am using DevExpress dxGridControl for viewing data. I used customized scrollbar in it.
Vertical scrollbar is working fine but Horizontal scrollbar is not working properly.
The Horizontal scrollbar is not customized & even though it is having issue of scrolling. For resolving this issued I replace Horizontal Scrollbar code with Normal horizontal scrollbar code, but not succeeded.
For more clarification please find Image at https://www.sugarsync.com/pf/D8670380_68034791_25743.
The sample project is also uploaded at SugarSync link of it is https://www.sugarsync.com/pf/D8670380_68034791_25575
Kindly guide me how to resolve it.
Thanks & Regards
|
|
|
|
|
I need to add two TextBlocks to each TreeView item, and have them be right-justified in the tree (in other words, butted up against the right side of the tree.
I've tried the following (this is the TreeView xaml), and I get the desired TextBlocks, but the are right next to the TreeViewItem itself.
<TreeView Name="sceneTree"
ItemContainerStyle="{DynamicResource SceneTreeItemStyle}"
PreviewMouseRightButtonDown="OnPreviewMouseRightButtonDown">
<TreeView.Resources>
<Style TargetType="{x:Type TreeViewItem}">
<Setter Property="HeaderTemplate">
<Setter.Value>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderThickness="2,0,0,0" BorderBrush="Transparent"
Background="Transparent" x:Name="PART_ItemBorder" Margin="0"
Padding="1,0,0,0" HorizontalAlignment="Stretch">
<Label Content="{Binding}" />
</Border>
<StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
<TextBlock Text=" ? " FontFamily="Arial" FontWeight="ExtraBlack" Background="Yellow" Foreground="Red" VerticalAlignment="Center" />
<TextBlock Text=" X " FontFamily="Arial" FontWeight="ExtraBlack" Background="Yellow" Foreground="Red" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</TreeView.Resources>
</TreeView>
The SceneTreeItemStyle looks like this (and the two TextBlock objects are displaying where I want them):
<Style x:Key="SceneTreeItemStyle" TargetType="{x:Type TreeViewItem}">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="HorizontalContentAlignment"
Value="{Binding HorizontalContentAlignment,
RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="VerticalContentAlignment"
Value="{Binding VerticalContentAlignment,
RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
<Setter Property="Padding" Value="1,0,0,0"/>
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
<Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TreeViewItem}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition MinWidth="19" Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<ToggleButton x:Name="Expander" ClickMode="Press"
IsChecked="{Binding IsExpanded,
RelativeSource={RelativeSource TemplatedParent}}"
Style="{StaticResource ExpandCollapseToggleStyle}"/>
<Border x:Name="Bd"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Grid.Column="1" Padding="{TemplateBinding Padding}"
SnapsToDevicePixels="true">
<ContentPresenter x:Name="PART_Header" ContentSource="Header"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
</Border>
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="3" Grid.Column="1"
Grid.Row="1" HorizontalAlignment="Stretch" />
<StackPanel Orientation="Horizontal" Grid.Column="3" HorizontalAlignment="Right">
<TextBlock Text=" ? " FontFamily="Arial" FontWeight="ExtraBlack"
Background="Yellow" Foreground="Red" VerticalAlignment="Center" />
<TextBlock Text=" X " FontFamily="Arial" FontWeight="ExtraBlack"
Background="Yellow" Foreground="Red" VerticalAlignment="Center" />
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Can anyone help?
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I'm not quite sure I get your question... but I'm assuming you are getting something like:
<tree view item>? X
and you want something like:
<tree view item> ? X
TreeViewItems don't stretch horizontally by default, so that's why you get the first version above. If you want the 2nd version (i.e. a "multi-column" tree view item), you'd need to stretch the TreeViewItem horizontally and fake the selection rectangle.
You are going to run into a bunch of alignment issues, so I'd suggest finding a real WPF multi-column TreeView control and using that, so items are properly aligned and clipped and thus your ? and X will be aligned properly.
|
|
|
|
|
I am using a list box in WPF. I allowed the users to paste the data to the listbox. I used the following if statement to check if users pressed Ctrl-V:
if (e.Key == Key.V && Keyboard.Modifiers == ModifierKeys.Control){}
But this if statement does not work if users pressed Ctrl and V at the same time. If users pressed the Ctrl and V at the same time, Key will be LeftCtrl and Keyboard.Modifiers will be none.
Thanks.
|
|
|
|
|
Rather than trying to brute force the paste handler, why not use DataObject.AddPastingHandler(MyListBox, OnClipboardPaste); to hook up a paste handler to your listbox?
|
|
|
|
|
It works. Thank you very much, really appreciate it.
|
|
|
|
|
|
Small team, but different preferences for formatting Xaml.
(and one member who can't use the VSCommands 'Format Xaml' option as vSCommands crashes his VS2010)
So if I check out some Xaml, make a small change and reformat it so it looks nice - a Diff shows just about every line as changed - even though it's just splitting most lines up over several lines...
IS there a source compare tool out there that handles this (essentially I guess I am looking for something that does not do a line-by-line compare but a text string compare, and ignores white space including new line/carriage return, tab, and spaces.
Is there something? Or alternatively how do you cope in a multiple dev environment?
|
|
|
|
|
_Maxxx_ wrote: but a text string compare, and ignores white space including new line/carriage return, tab, and spaces.
Just thinking about that made my eyes cross, I once did a csv reader that supported the text qualifier - that was simple compared to this requirement.
I refuse to use 2 spaces for a tab and ALWAYS change it to 2 spaces, in VS SSMS everywhere. I also have the authority to make all the others conform. I don't think I could enforce a xaml layout - I can't make up my mind which layout to use!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: that made my eyes cross,
and there's nothing worse than angry eyes
it shouldn't be THAT big a problem - just have to decide when to give up looking for matching strings and treat the whole thing as one ling text string, rather than a series of lines.
My preference is to use tabs for layout - then each user can just adjust their own tab size for display without the need to change code at all.
|
|
|
|
|