Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Keytrap
    @varKeytrap
    @ghost1372 thank you 👍🏼
    August
    @auggieball
    Hey everyone :D
    Here's way better than irc channels xD
    Mahdi Hosseini
    @ghost1372
    yeah
    welcome to handycontrols
    آگوست جان فارسی هم دوست داشتی بنویس
    August
    @auggieball
    I'm OK with English :D!
    Mahdi Hosseini
    @ghost1372
    ok
    Keytrap
    @varKeytrap
    Hi and welcome 😉
    Keytrap
    @varKeytrap
    Any idea how to set primary brush on the foreground of SideMenuItem if SideMenu when selected ?
    <hc:SideMenu x:Name="SideMenu" Selector.SelectionChanged="SideMenu_SelectionChanged_1" Width="200" DockPanel.Dock="Left"  Background="{StaticResource PrimaryBrush}" SelectionChanged="SideMenu_SelectionChanged"  >
                        <hc:SideMenu.ItemTemplate>
                            <DataTemplate>
                                <DataTemplate.Triggers>
                                    <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                                        <Setter Property="TextElement.Foreground" Value="{StaticResource PrimaryBrush}"/>
                                    </DataTrigger>
                                </DataTemplate.Triggers>
                            </DataTemplate>
                        </hc:SideMenu.ItemTemplate>
    </hc:SideMenu>
    Mahdi Hosseini
    @ghost1372
     <hc:BlurWindow.Resources>
            <Style x:Key="xx" TargetType="hc:SideMenuItem" BasedOn="{StaticResource SideMenuItemBaseStyle}">
                <Setter Property="Foreground" Value="Black"/>
                <Style.Triggers>
                    <Trigger Property="IsSelected" Value="True">
                        <Setter Property="Foreground" Value="{DynamicResource PrimaryBrush}"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </hc:BlurWindow.Resources>
        <Grid>
            <hc:SideMenu ItemContainerStyle="{StaticResource xx}" x:Name="SideMenu" Width="200" DockPanel.Dock="Left">
                <hc:SideMenuItem Header="asd"/>
                <hc:SideMenuItem Header="asd"/>
                <hc:SideMenuItem Header="asd"/>
    
            </hc:SideMenu>
        </Grid>
    Mahdi Hosseini
    @ghost1372
    @BadNiiw there is no binding to itemtemplate in the style
    you can try this way
    Keytrap
    @varKeytrap
    Okay nice thanks
    Keytrap
    @varKeytrap

    When I apply the style I get System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='HandyControl.Controls.SideMenuItem', AncestorLevel='1''. BindingExpression:Path=IsSelected; DataItem=null; target element is 'SideMenuItem' (Name=''); target property is 'NoTarget' (type 'Object')

    It works but the SideMenuItem won't expand anymore

    Keytrap
    @varKeytrap
    Hello, any idea how to do that in code behind ? <hc:PasswordBox PasswordBox.PasswordChanged="PasswordBox_PasswordChanged"/>
    Mahdi Hosseini
    @ghost1372
    yeap, do like this
    note: pass is HandyControl.Controls.PassswordBox and PassWordBox.PasswordChangedEvent is System.Windows.Controls
    Mahdi Hosseini
    @ghost1372
    pass.AddHandler(PasswordBox.PasswordChangedEvent, new RoutedEventHandler(Pass_PasswordChanged), true);
    
    private void Pass_PasswordChanged(object sender, System.Windows.RoutedEventArgs e)
     {
     MessageBox.Show("adad");
     }
    Keytrap
    @varKeytrap
    Perfect, thanks
    Keytrap
    @varKeytrap
    Hey, any idea of how to capture contentchanged event on hc:TransitioningContentControl ?
    I tried inherit from TransitioningContentControl and add a custom event but it doesn't work (followed this http://dotnetgui.blogspot.com/2013/03/contentcontrol-contentchangedevent.html)
    Mahdi Hosseini
    @ghost1372
    @TheKeytrap Hi, I'm a little busy, I'll check it out soon
    Keytrap
    @varKeytrap
    @ghost1372 No problem thanks ;)
    Mahdi Hosseini
    @ghost1372

    @TheKeytrap hi try this way
    first add this event and method

    public event DependencyPropertyChangedEventHandler ContentChanged;
    
            static TransitioningContentControl()
            {
                ContentProperty.OverrideMetadata(typeof(TransitioningContentControl),
                    new FrameworkPropertyMetadata(
                        new PropertyChangedCallback(OnContentChanged)));
            }
            private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
                var ts = d as TransitioningContentControl;
                if (ts.ContentChanged != null)
                {
                    DependencyPropertyChangedEventArgs args = new DependencyPropertyChangedEventArgs(ContentProperty, e.OldValue, e.NewValue);
                    ts.ContentChanged(ts, args);
                }
                TransitioningContentControl.trsControl.StartTransition(e.OldValue, e.NewValue);
            }

    Because the StartTransition function is not static we need to access it, So also define the following variable and set it to the public function

    internal static TransitioningContentControl trsControl;
    public TransitioningContentControl()
            {
                if (!DesignerProperties.GetIsInDesignMode(this))
                {
                    DefaultStyleKey = typeof(TransitioningContentControl);
                }
                trsControl = this;
    
            }

    Finally remove the overridden function protected override void OnContentChanged

    You can now use the event

    example:

     var btn = new Button();
                btn.Content = "Test";
                btn.Click += Btn_Click;
                tr.Content = btn;
                tr.ContentChanged += Tr_ContentChanged;
    
    private void Tr_ContentChanged(object sender, DependencyPropertyChangedEventArgs e)
            {
                MessageBox.Show("Content Changed!");
            }
    
    private void Btn_Click(object sender, System.Windows.RoutedEventArgs e)
            {
                var btn2 = new Button { Content = "Click Me" };
                btn2.Click += Btn2_Click;
                tr.Content = btn2;
            }
    
    private void Btn2_Click(object sender, RoutedEventArgs e)
            {
                var btn3 = new Button { Content = "Test HHHHH" };
                tr.Content = btn3;
            }
    Keytrap
    @varKeytrap
    Hi, I didn't understand in which class am I supposed to put the functions and changed event?
    Mahdi Hosseini
    @ghost1372
    @TheKeytrap in TransitioningContentControl.cs class and if you wait a bit, it looks like this has been added to the Add-SplitButton branch https://github.com/HandyOrg/HandyControl/commit/a54fc6986922c0bc03b4bfff2c0450724a5029e0#diff-5baaa59d0e1d6c6a91fde7913b242e24
    Keytrap
    @varKeytrap
    Oh Nice thanks👍🏼
    Keytrap
    @varKeytrap
    I have pulled the split button branch and replace original HandyControl.dll by this one but still aint see the ContentChanged Event
    image.png
    Mahdi Hosseini
    @ghost1372

    @TheKeytrap Yes because the event is not publicly created
    You can change it to work
    Add This First

    public event DependencyPropertyChangedEventHandler ContentChanged;

    Now Change OnContentChanged function from this

    private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
    
                var ctl = (TransitioningContentControl) d;
                ctl.StartTransition(e.OldValue, e.NewValue);
            }

    To This

    private static void OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
            {
    
                var ctl = (TransitioningContentControl) d;
                if (ctl.ContentChanged != null)
                {
                    DependencyPropertyChangedEventArgs args = new DependencyPropertyChangedEventArgs(ContentProperty, e.OldValue, e.NewValue);
                    ctl.ContentChanged(ctl, args);
                }
                ctl.StartTransition(e.OldValue, e.NewValue);
            }
    Keytrap
    @varKeytrap
    Ok thanks, will this be integrated un futur releases you think ?
    Mahdi Hosseini
    @ghost1372
    I am not sure
    Keytrap
    @varKeytrap
    It's a pity to not have this event for a control like this. It's like having a button with no Click event.. ^^
    Mahdi Hosseini
    @ghost1372
    😅 Well you convinced me
    If NBian does not add.
    I'll add it myself
    Keytrap
    @varKeytrap
    😀 ok nice
    Keytrap
    @varKeytrap
    Heya, any idea why <hc:TabControl DockPanel.Dock="Right" Style="{StaticResource TabControlCapsuleSolid}" TabStripPlacement="Top" ShowCloseButton="True" ShowScrollButton="True" >
    ShowCloseButton won't work ?
    image.png
    Keytrap
    @varKeytrap
    Oh, actually just noticed that if you use a style for tabcontrol the closebutton dissapears 🤔
    Mahdi Hosseini
    @ghost1372
    in hc:TabControl you cant use style, If you use, you lose the properties like closebutton
    Keytrap
    @varKeytrap
    I have managed by creating own tabitem control finally😀
    Mahdi Hosseini
    @ghost1372
    😉
    Keytrap
    @varKeytrap
    Any idea how could I expand a SideMenuItem by code ?
    Mahdi Hosseini
    @ghost1372
    Unfortunately it is not considered
    SideMenu is actually just a simple control of the Azure SideMenu
    You can only change the ExpandMode
    SideMenu.ExpandMode = HandyControl.Data.ExpandMode.ShowAll;
    Keytrap
    @varKeytrap
    Oh ok :/
    Keytrap
    @varKeytrap
    Hi, any idea how to set the index of Stepbar manually ? I only have Stepbar.Next() method, and set is protected
    Keytrap
    @varKeytrap
    for now I do it like this:
     public static void SetStep(this StepBar stepBar, int index)
            {
                while (stepBar.StepIndex != index)
                {
                    if (stepBar.StepIndex > index)
                        stepBar.Prev();
                    else
                        stepBar.Next();
    
                    Console.WriteLine(stepBar.StepIndex);
                }
    
            }
    Mahdi Hosseini
    @ghost1372
    hi sorry for late response, unfortunately there is no other way
    Keytrap
    @varKeytrap
    No problem, it’s fine like this anyway