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 Reply
  • 35
    Offline posted in reply to Michael Peterson

    <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

    The above mentioned Tags for implementing style such as color,fonts and bold.

    This I am binding. "MyNodeStyle" in NodeStyle="{StaticResource MyNodeStyle}" of XamNetworkNode.

    Can You Please suggest some other way?

Children