Click here to Skip to main content
16,008,490 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: How to open second page on click event Pin
maciej.tokarz17-Jul-12 3:01
maciej.tokarz17-Jul-12 3:01 
AnswerRe: How to open second page on click event Pin
Mycroft Holmes17-Jul-12 12:39
professionalMycroft Holmes17-Jul-12 12:39 
AnswerRe: How to open second page on click event Pin
Abhinav S17-Jul-12 16:01
Abhinav S17-Jul-12 16:01 
QuestionFruit Ninja sword effect Pin
wasimsharp15-Jul-12 6:27
wasimsharp15-Jul-12 6:27 
AnswerRe: Fruit Ninja sword effect Pin
Maximilien15-Jul-12 6:41
Maximilien15-Jul-12 6:41 
GeneralRe: Fruit Ninja sword effect Pin
wasimsharp15-Jul-12 6:44
wasimsharp15-Jul-12 6:44 
GeneralRe: Fruit Ninja sword effect Pin
Paul Conrad19-Jul-12 18:22
professionalPaul Conrad19-Jul-12 18:22 
QuestionWPF TreeView Style Pin
Kevin Marois13-Jul-12 10:07
professionalKevin Marois13-Jul-12 10:07 
Ok, I finally got my treeview with hyperlinks working. Thanks SledgeHammer!

I now have the following

<Window.Resources>

    <Style x:Key ="linkStyle"
           TargetType="{x:Type Hyperlink}" >
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="TextBlock.TextDecorations" Value="Underline"/>
                <Setter Property="Foreground" Value="RoyalBlue" />
            </Trigger>
            <Trigger Property="IsMouseOver" Value="False">
                <Setter Property="TextBlock.TextDecorations" Value="{x:Null}"/>
                <Setter Property="Foreground" Value="RoyalBlue" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <HierarchicalDataTemplate DataType="{x:Type models:NodeModel}"
                          ItemsSource="{Binding Path=Children}">
        <StackPanel Orientation="Horizontal"
                Margin="2">

            <TextBlock>

                <Hyperlink NavigateUri="{Binding Caption}"
                           Foreground="#0C2DAA"
                           Style="{StaticResource linkStyle}"
                           CommandParameter="{Binding}"
                           Command="{Binding Path=DataContext.SelectedLinkCommand,
                                    RelativeSource={RelativeSource FindAncestor,
                                    AncestorType={ x:Type views:MainWindowView}}}">

                    <InlineUIContainer>
                        <TextBlock Text="{Binding Caption}" />
                    </InlineUIContainer>

                </Hyperlink>

            </TextBlock>

        </StackPanel>

    </HierarchicalDataTemplate>

</Window.Resources>

<Grid>

    <controls:TreeViewEx ItemsSource="{Binding TreeData}"
                         SelectedItemEx="{Binding SelectedTreeItem, Mode=TwoWay}"
                         Grid.Row="0"
                         Grid.Column="0">

        <TreeView.Resources>
            <!--Make the selected item's background transparent-->
            <SolidColorBrush Color="Transparent" x:Key="{x:Static SystemColors.HighlightBrushKey}"/>
        </TreeView.Resources>

        <TreeView.ItemContainerStyle>
            <Style TargetType="{x:Type TreeViewItem}">
                <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
            </Style>
        </TreeView.ItemContainerStyle>

    </controls:TreeViewEx>

</Grid>



I'd really like to have all the treeview styling done in one place, but I'm not sure how. I would like to move

<TreeView.Resources>
    <!--Make the selected item's background transparent-->
    <SolidColorBrush Color="Transparent" x:Key="{x:Static SystemColors.HighlightBrushKey}"/>
</TreeView.Resources>

<TreeView.ItemContainerStyle>
    <Style TargetType="{x:Type TreeViewItem}">
        <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
    </Style>
</TreeView.ItemContainerStyle>


out of the treeview up to the Window.Resources section.
If it's not broken, fix it until it is

AnswerRe: WPF TreeView Style Pin
Cracked-Down17-Jul-12 21:52
Cracked-Down17-Jul-12 21:52 
QuestionCall Web Service From Silverlight Application Pin
youness12-Jul-12 22:55
youness12-Jul-12 22:55 
AnswerRe: Call Web Service From Silverlight Application Pin
Pete O'Hanlon12-Jul-12 23:07
mvePete O'Hanlon12-Jul-12 23:07 
GeneralRe: Call Web Service From Silverlight Application Pin
youness13-Jul-12 5:23
youness13-Jul-12 5:23 
GeneralRe: Call Web Service From Silverlight Application PinPopular
Pete O'Hanlon15-Jul-12 11:13
mvePete O'Hanlon15-Jul-12 11:13 
GeneralRe: Call Web Service From Silverlight Application Pin
Mycroft Holmes16-Jul-12 0:34
professionalMycroft Holmes16-Jul-12 0:34 
GeneralRe: Call Web Service From Silverlight Application Pin
Pete O'Hanlon16-Jul-12 1:15
mvePete O'Hanlon16-Jul-12 1:15 
AnswerRe: Call Web Service From Silverlight Application Pin
Anumeha Shukla15-Jul-12 23:36
Anumeha Shukla15-Jul-12 23:36 
AnswerRe: Call Web Service From Silverlight Application Pin
vinodkrebc17-Jul-12 19:46
vinodkrebc17-Jul-12 19:46 
QuestionWPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 10:26
professionalKevin Marois12-Jul-12 10:26 
AnswerRe: WPF Hyperlink In Treeview Problem Pin
Ian Shlasko12-Jul-12 10:55
Ian Shlasko12-Jul-12 10:55 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 11:10
professionalKevin Marois12-Jul-12 11:10 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Ian Shlasko12-Jul-12 11:22
Ian Shlasko12-Jul-12 11:22 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 11:23
SledgeHammer0112-Jul-12 11:23 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 11:34
professionalKevin Marois12-Jul-12 11:34 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 12:13
SledgeHammer0112-Jul-12 12:13 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 12:23
professionalKevin Marois12-Jul-12 12:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.