Click here to Skip to main content
15,890,882 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: ListBox with Hyperlinks Problem Pin
Gerry Schmitz24-Feb-19 9:21
mveGerry Schmitz24-Feb-19 9:21 
GeneralRe: ListBox with Hyperlinks Problem Pin
Kevin Marois27-Feb-19 4:53
professionalKevin Marois27-Feb-19 4:53 
AnswerRe: ListBox with Hyperlinks Problem Pin
Richard Deeming27-Feb-19 8:00
mveRichard Deeming27-Feb-19 8:00 
QuestionHow to solve erroneous designer intellisense error report Pin
Super Lloyd26-Jan-19 19:29
Super Lloyd26-Jan-19 19:29 
AnswerRe: How to solve erroneous designer intellisense error report Pin
Gerry Schmitz28-Jan-19 8:24
mveGerry Schmitz28-Jan-19 8:24 
GeneralRe: How to solve erroneous designer intellisense error report Pin
Super Lloyd28-Jan-19 14:42
Super Lloyd28-Jan-19 14:42 
QuestionHave two controls fill the MainWindow and resize automatically Pin
Mc_Topaz16-Jan-19 4:14
Mc_Topaz16-Jan-19 4:14 
AnswerRe: Have two controls fill the MainWindow and resize automatically Pin
Richard Deeming16-Jan-19 8:07
mveRichard Deeming16-Jan-19 8:07 
GeneralRe: Have two controls fill the MainWindow and resize automatically Pin
Mc_Topaz16-Jan-19 19:22
Mc_Topaz16-Jan-19 19:22 
QuestionHyperlink Context Menu Pin
Kevin Marois9-Jan-19 15:30
professionalKevin Marois9-Jan-19 15:30 
AnswerRe: Hyperlink Context Menu Pin
Richard Deeming10-Jan-19 0:32
mveRichard Deeming10-Jan-19 0:32 
GeneralRe: Hyperlink Context Menu Pin
Kevin Marois10-Jan-19 4:32
professionalKevin Marois10-Jan-19 4:32 
GeneralRe: Hyperlink Context Menu Pin
Kevin Marois10-Jan-19 5:31
professionalKevin Marois10-Jan-19 5:31 
QuestionTreeView Item Show Button Using Trigger Pin
Kevin Marois1-Jan-19 11:41
professionalKevin Marois1-Jan-19 11:41 
AnswerRe: TreeView Item Show Button Using Trigger Pin
Gerry Schmitz5-Jan-19 7:22
mveGerry Schmitz5-Jan-19 7:22 
GeneralRe: TreeView Item Show Button Using Trigger Pin
Kevin Marois7-Jan-19 7:31
professionalKevin Marois7-Jan-19 7:31 
GeneralRe: TreeView Item Show Button Using Trigger Pin
Gerry Schmitz7-Jan-19 8:39
mveGerry Schmitz7-Jan-19 8:39 
GeneralRe: TreeView Item Show Button Using Trigger Pin
Kevin Marois7-Jan-19 9:18
professionalKevin Marois7-Jan-19 9:18 
GeneralRe: TreeView Item Show Button Using Trigger Pin
J. Calhoun14-Feb-19 4:37
J. Calhoun14-Feb-19 4:37 
QuestionWPF Items Source get the visible items Pin
Paul M Gibson31-Dec-18 7:00
Paul M Gibson31-Dec-18 7:00 
I have a ScrollViewer with an ItemsSource that holds a user control. I need to know what the top visible item is in the scrollviewer at any given time, and I want my ViewModel to be able to react when the top item visible changes. I think that there is no built in functionality to do this, so perhaps I need to generate mouse down events in an attempt to select the topmost item, though I'd rather not have to do this.

here is the xaml for the top level stuff:

XML
<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Column="0" Grid.Row="3" Grid.ColumnSpan="2" ScrollChanged="ScrollViewer_ScrollChanged">
            <ItemsControl x:Name="DivisionItems" ItemsSource="{Binding oObsByDiv}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <uc:ucObservationsHeader/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>


The ObservationHeader user control maps to a category for each set of observations, and is this:

XML
<UserControl x:Class="MOATools.Views.ucObservationsHeader"            
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"             
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:uc="clr-namespace:MOATools.Views"
    mc:Ignorable="d" d:DesignHeight="115" d:DesignWidth="400">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="100"/>
            <ColumnDefinition Width="300*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="20"/>
            <RowDefinition Height="100*"/>
        </Grid.RowDefinitions>
        <TextBox x:Name="divNum" Text="{Binding DivNum, Mode=OneWay}" Grid.Column="0" Grid.Row="0" Margin="0,3,0,0"/>
        <TextBox x:Name="divName" Text="{Binding DivName, Mode=OneWay}" Grid.Column="1" Grid.Row="0" Margin="0,3,0,0"/>
            <ItemsControl ItemsSource="{Binding lObs}" Grid.Row="1" Grid.Column="1">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <uc:ucObservationsView/>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
    </Grid>
</UserControl>


Each observation header then has a list of observations mapped to the ObservationsView:

XML
<UserControl x:Class="MOATools.Views.ucObservationsView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
             mc:Ignorable="d" d:DesignHeight="75" d:DesignWidth="400">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25"/>
            <RowDefinition Height="25*"/>
            <RowDefinition Height="25*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width=".2*"/>
            <ColumnDefinition Width=".4*"/>
            <ColumnDefinition Width=".4*"/>
        </Grid.ColumnDefinitions>
        <TextBox x:Name="txtDivObs" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="{Binding obsFullNum, Mode=OneWay}" Grid.Column="0" Grid.Row="0"/>
        <Label x:Name="lblOpenDate" HorizontalAlignment="Left" Content="Open " Grid.Column="1" Grid.Row="0"/>
        <DatePicker x:Name="dtOpen" HorizontalAlignment="Right" SelectedDate="{Binding Opendate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Grid.Column="1" Grid.Row="0"/>
        <Label x:Name="lblCLoseDate" HorizontalAlignment="Left" Content="Close " Grid.Column="2" Grid.Row="0"/>
        <DatePicker x:Name="txtCloseDate" HorizontalAlignment="Right" SelectedDate="{Binding Closedate}" Grid.Column="2" Grid.Row="0"/>
        <TextBox x:Name="txtDescription" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="{Binding Description}" VerticalAlignment="Top" Grid.ColumnSpan="3" Grid.Row="1"/>
        <TextBox x:Name="txtImagePath" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="{Binding ImagePath}" Grid.Row="2" Grid.ColumnSpan="3">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="PreviewMouseLeftButtonUp">
                    <i:InvokeCommandAction Command="{Binding DataContext.PreviewImage, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
                                           CommandParameter="{Binding}"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TextBox>
    </Grid>
</UserControl>



What I want is that as the user scrolls through the categories and observations, each time a new observation category hits the top of the window then a combo box that is bound to a list of the categories to be set to that category. This will make it easy for the user to enter a new observation by defaulting to the current category that they see in the window. I don't want them to have to first select the header or an observation because extra clicks like that are just bad design. But I can't find any way for the view to know anything about the items that are scrolled into view. The scroll viewer can give me a vertical scroll position, but it's not really correlated to the actual parent and child items in the datastructure. Is this possible?
AnswerRe: WPF Items Source get the visible items Pin
Gerry Schmitz1-Jan-19 6:42
mveGerry Schmitz1-Jan-19 6:42 
GeneralRe: WPF Items Source get the visible items Pin
Paul M Gibson2-Jan-19 6:22
Paul M Gibson2-Jan-19 6:22 
QuestionAd Control / monetization Pin
Super Lloyd18-Dec-18 13:02
Super Lloyd18-Dec-18 13:02 
AnswerRe: Ad Control / monetization Pin
Pete O'Hanlon18-Dec-18 22:17
mvePete O'Hanlon18-Dec-18 22:17 
GeneralRe: Ad Control / monetization Pin
Super Lloyd19-Dec-18 15:40
Super Lloyd19-Dec-18 15:40 

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.