Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
35
My Question is about XamNetworkNode
posted

This is .xaml File 

<ig:XamNetworkNode
x:Name="xnn" Background="AliceBlue"
NodeControlAttachedEvent="Xnn_NodeControlAttachedEvent"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
ItemsSource="{Binding Persons}" ZoomLevel="2"
LineEndCap="SolidArrow" LineCapSize="10"
SelectionType="Single"
Grid.Row="3" FontSize="20" SelectedNodesCollectionChanged="xnn_SelectedNodesCollectionChanged"
>
<ig:XamNetworkNode.GlobalNodeLayouts>
<ig:NetworkNodeNodeLayout
x:Name="xmnode"
TargetTypeName="Person"
NodeStyle="{StaticResource MyNodeStyle}"
ConnectionsMemberPath="Connections" ConnectionTargetMemberPath="Target"
ConnectionWeightMemberPath="Weight"
ToolTipMemberPath="ToolTip" DisplayMemberPath="Name"
/>
</ig:XamNetworkNode.GlobalNodeLayouts>


</ig:XamNetworkNode>

Iin xaml.cs

private void xnn_SelectedNodesCollectionChanged(object sender, Infragistics.Controls.Maps.NetworkNodeSelectionEventArgs e)
{
for (int i = 0; i < xnn.SelectedNodes.Count; i++)
{
this.tb_DisaplayNode.Text = ((Person)xnn.SelectedNodes[i].Data).Name;
}
}

This event is not raising while I am selecting any node but It is raising in some other event,

So not able to find the current selected node

Parents
  • 25665
    Verified Answer
    Offline posted

    Hello Rajni,

    I followed the steps you suggested and was unable to reproduce the behavior you're describing. I created a sample XamNetworkNode and enabled selection and handled the selection changed event. The event fired every time I selected a different node.

    I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this problem.

    If the project does not work correctly, then the change in behavior is due to differences in your environment from mine and these differences can be anything from operating system version to the specific version of the Infragistics DLL versions used. My test was performed using version 18.2.20182.186 in Infragistics for WPF 2018 Volume 2. Please provide more details about your machine and version of the assemblies that you are referencing so that I can modify the environment that I am testing in to match yours.

    If the project does show the product feature working correctly, then more information will be needed to reproduce the issue in a sample that can be used for debugging. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing. This can be done by either be done by making the sample that I provided more like your application or by isolating the behavior from your application by removing dependencies on any third parties or databases.

    Please let me know if I can provide any further assistance.

    XamNetworkNode.zip

  • 35
    Offline posted in reply to Rajni Gupta

    <UserControl x:Class="XamNetworkNode.MainWindow"

            xmlns="">schemas.microsoft.com/.../presentation"

            xmlns:x="">schemas.microsoft.com/.../xaml"

            xmlns:d="">schemas.microsoft.com/.../2008"

            xmlns:mc="">schemas.openxmlformats.org/.../2006"

            xmlns:local="clr-namespace:XamNetworkNode"

            xmlns:ig="">schemas.infragistics.com/xaml"

            mc:Ignorable="d"

              Height="450" Width="800">

        <!--<UserControl.Resources>

            <ResourceDictionary>

                <ResourceDictionary.MergedDictionaries>

                    <ResourceDictionary Source="Skins/MainSkin.xaml" />

                </ResourceDictionary.MergedDictionaries>

            </ResourceDictionary>

        </UserControl.Resources>-->

        <Grid VerticalAlignment="Stretch">

            <!--<Grid.Resources>

                <local:SimpleGraphData x:Key="GraphData" />

            </Grid.Resources>-->

            <Grid.RowDefinitions>

                <RowDefinition/>

                <RowDefinition Height="auto"/>

            </Grid.RowDefinitions>

            <Grid x:Name="LayoutRoot">

                <Grid.Resources>

                    <!--

    www.infragistics.com/.../infragisticswpf.controls.maps.xamnetworknode~infragistics.controls.maps.networknodenodecontrol_members                       

    -->

                    <!--

     Configuration: *CFG* - text color, font shadow color

     text color:            Foreground="White"

     font shadow color:     <DropShadowEffect Color="Black"                    

     -->

                    <Style x:Key="MyNodeStyle" TargetType="{x:Type ig:NetworkNodeNodeControl}">

                        <Setter Property="Template">

                            <Setter.Value>

                                <ControlTemplate TargetType="{x:Type ig:NetworkNodeNodeControl}">

                                    <Grid x:Name="ButtonGrid">

                                        

                                            <Border CornerRadius="20" Background="{Binding Color}" BorderThickness="0">

                                            <TextBox

                                                        Background="Transparent" IsReadOnly="True"

                                                        Text="{Binding Name}" Padding="20"  BorderThickness="0"

                                                        FontSize="{Binding FontSize}" TextWrapping="Wrap"

                                                        VerticalAlignment="Center" HorizontalAlignment="Center">

                                                <TextBox.Resources>

                                                    <Style TargetType="{x:Type TextBox}">

                                                        <Style.Triggers>

                                                            <Trigger Property="IsMouseOver" Value="True">

                                                                <Setter Property="Foreground" Value="Blue"/>

                                                            </Trigger>

                                                            <Trigger Property="IsMouseOver" Value="False">

                                                                <Setter Property="Foreground" Value="White"/>

                                                            </Trigger>

                                                        </Style.Triggers>

                                                    </Style>

                                                </TextBox.Resources>

                                                <TextBox.Effect>

                                                    <DropShadowEffect ShadowDepth="3" Color="Black" Opacity="1" BlurRadius="3" />

                                                </TextBox.Effect>

                                            </TextBox>

                                        </Border>

                                    </Grid>

                                </ControlTemplate>

                            </Setter.Value>

                        </Setter>

                    </Style>

     

                </Grid.Resources>

     

                <Grid.RowDefinitions>

                    <RowDefinition Height="auto"/>

                    <RowDefinition Height="auto"/>

                    <RowDefinition Height="auto"/>

                    <RowDefinition/>

                </Grid.RowDefinitions>

     

                <StackPanel Grid.Row="2" Orientation="Horizontal">

                <!-- <TextBox Text="{Binding OrigAcctID, Delay=1000, UpdateSourceTrigger=PropertyChanged}"/> -->

     

                <Button x:Name="btnFetchData" Content="Fetch Data" Margin="5" Padding="5" Command="{Binding CmdFetch}" />

                <!--<Label Content="ID" VerticalAlignment="Center"/>-->

                <TextBox x:Name="txtOrigAcct" Text="{Binding OrigAcctID}"  Padding="5" Width="150" VerticalAlignment="Center"   Visibility="Hidden"    />

                <Label Content="PPLStatus" VerticalAlignment="Center"/>

                <TextBox x:Name="txtPPLStatus" Text="{Binding PPLStatus}" Padding="5" Width="50" VerticalAlignment="Center"  />

                <!--<Label Content="Depth" VerticalAlignment="Center"/>-->

                <Label Content="Depth" VerticalAlignment="Center"/>

                <TextBox x:Name="txtDepth" Text="{Binding Depth}" Padding="5" Width="50" VerticalAlignment="Center"  />

                <!--<ComboBox x:Name = "cmbDepth" Margin="5" Padding="5" Width="50"  ItemsSource = "{Binding depth}" SelectedItem = "{Binding SelectedDepth}"/>-->

     

               

            </StackPanel>

             

     

            <ig:XamNetworkNode x:Name="xnn" SelectedNodesCollectionChanged="xnn_SelectedNodesCollectionChanged" SelectionType="Single"

                           ItemsSource="{Binding Persons}">

                <ig:XamNetworkNode.GlobalNodeLayouts>

                    <ig:NetworkNodeNodeLayout

                    TargetTypeName = "Person"

                    DisplayMemberPath = "Name"

                    ToolTipMemberPath = "ToolTip"

                    ConnectionsMemberPath = "Connections"

                    ConnectionTargetMemberPath = "Target"

                        ConnectionWeightMemberPath="Weight"

                         NodeStyle="{StaticResource MyNodeStyle}"           

                      

                         /> 

                            

                       

                   

                </ig:XamNetworkNode.GlobalNodeLayouts>

            </ig:XamNetworkNode>

            </Grid>

        </Grid>

        </UserControl>

     

    Here is .xaml Design code

      When I removed this then event is working fine but I need to add this code also for formatting

    NodeStyle="{StaticResource MyNodeStyle}"   

    Can you please suggest any good way?

Reply Children