Telerik Forums
UI for WPF Forum
0 answers
4 views
The RadToggleSwitchButton has properties for content when the button is checked(CheckedContent) and unchecked(UncheckedContent), but when three state is enabled and the value is set to null, the content is empty. How do I set the content when the RadToggleSwitchButton is in three state mode and the state is set to null?
Johnathan
Top achievements
Rank 1
 asked on 17 Apr 2024
1 answer
13 views
Is there a way to delete all rows inside a RadGridView after a button event has been pressed?
The documentation shows how to delete the row/rows via keyboard(from a user) or manually but didn't found via code

Example: The user presses a button that deletes all text inside textboxes including the rows data inside the RadGridView
Martin Ivanov
Telerik team
 answered on 04 Apr 2024
0 answers
18 views

We recently updated to version 2024.1.312.  After the update, we get an exception (see stack trace below) or freezing with many of our RadToggleSwitchButtons.  It seems to only affect the ones that are backstage in a RadDataForm.  I found https://feedback.telerik.com/wpf/1645011-buttons-nullreferenceexception-when-setting-ischecked-of-radtoggleswitchbutton-before-the-control-is-added-to-the-visual-tree, but the workaround suggested there doesn't work for us, even if we leave the animations enabled.

System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=Telerik.Windows.Controls
  StackTrace:
   at Telerik.Windows.Controls.RadToggleSwitchButton.OnIsCheckedPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.PropertyChangedCallback.Invoke(DependencyObject d, DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   at System.Windows.StyleHelper.ApplyTemplatedParentValue(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, DependencyProperty dp, FrameworkElementFactory templateRoot)
   at System.Windows.StyleHelper.InvalidatePropertiesOnTemplateNode(DependencyObject container, FrameworkObject child, Int32 childIndex, FrugalStructList`1& childRecordFromChildIndex, Boolean isDetach, FrameworkElementFactory templateRoot)
   at System.Windows.FrameworkTemplate.InvalidatePropertiesOnTemplate(DependencyObject container, Object currentObject)
   at System.Windows.FrameworkTemplate.HandleBeforeProperties(Object createdObject, DependencyObject& rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
   at System.Windows.FrameworkTemplate.<>c__DisplayClass45_0.<LoadOptimizedTemplateContent>b__2(Object sender, XamlObjectEventArgs args)
   at System.Xaml.XamlObjectWriter.OnBeforeProperties(Object value)
   at System.Xaml.XamlObjectWriter.Logic_CreateAndAssignToParentStart(ObjectWriterContext ctx)
   at System.Xaml.XamlObjectWriter.WriteStartMember(XamlMember property)
   at System.Xaml.XamlWriter.WriteNode(XamlReader reader)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter)
   at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter)
   at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField)
   at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren)
   at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
   at System.Windows.FrameworkTemplate.ApplyTemplateContent(UncommonField`1 templateDataField, FrameworkElement container)
   at System.Windows.FrameworkElement.ApplyTemplate()
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.StackPanel.StackMeasureHelper(IStackMeasure measureElement, IStackMeasureScrollData scrollData, Size constraint)
   at System.Windows.Controls.StackPanel.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at MS.Internal.Helper.MeasureElementWithSingleChild(UIElement element, Size constraint)
   at System.Windows.Controls.ItemsPresenter.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Border.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Control.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.Controls.Grid.MeasureCell(Int32 cell, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV, Boolean& hasDesiredSizeUChanged)
   at System.Windows.Controls.Grid.MeasureCellsGroup(Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
   at System.Windows.Controls.Grid.MeasureOverride(Size constraint)
   at System.Windows.FrameworkElement.MeasureCore(Size availableSize)
   at System.Windows.UIElement.Measure(Size availableSize)
   at System.Windows.ContextLayoutManager.UpdateLayout()
   at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
   at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork()
   at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
   at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Threading.DispatcherOperation.Invoke()
   at System.Windows.Threading.Dispatcher.ProcessQueue()
   at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()

 

Jennifer
Top achievements
Rank 1
Iron
 updated question on 26 Mar 2024
0 answers
27 views

Hi
Please find my below code showing the celledittemplate

<telerik:GridViewDataColumn.CellEditTemplate>
    <DataTemplate>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <tbcontrols:SmartSearchRadAutoCompleteBox x:Name="JournalSuggestions" AutomationProperties.AutomationId="JournalSuggestions" 
                                        Style="{StaticResource SmartControlStyle}"  
                                        SelectionMode="Single" 
                                        KeyDown="JournalSuggestions_KeyDown"                                                                        
                                        PreviewGotKeyboardFocus="JournalSuggestions_PreviewGotKeyboardFocus"
                                        Populating="JournalSuggestions_Populating"
                                        Width="{Binding RelativeSource={RelativeSource AncestorType=telerik:GridViewDataColumn}, Path=ActualWidth}"
                                        BorderThickness="0" 
                                        BorderBrush="Transparent" 
                                        ClipToBounds="True" 
                                        AutoCompleteMode="Suggest"
                                        ItemsSource="{Binding Source={StaticResource SmartJournalAccounts}}"
                                        DisplayMemberPath="Code" 
                                        FilteringBehavior="{StaticResource LocalJournalFilter}"
                                        HorizontalAlignment="Stretch" 
                                        VerticalAlignment="Stretch"
                                        VerticalContentAlignment="Center"
                                        DropDownItemTemplate="{Binding Source={StaticResource CustomDropDownTemplate}}" 
                                        NoResultsContentTemplate="{StaticResource NoResultsContentTemplate}"
                                        DropDownWidth="Auto"  
                                        BoxesItemStyle="{StaticResource CustomRadAutoCompleteBoxesItemStyle}" 
                                        IsEnabled="True" 
                                        Margin="-17 0 0 0"                                                                        
                                        SearchText="{Binding DataContext.SmartControlSearchText, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadGridView}}, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"
                                        SelectedItem="{Binding Path=SmartJournalAccountItem, Mode=TwoWay}"
                                        TextSearchMode="Contains" TextBoxStyle="{StaticResource TrailBalanceAccountTextBoxStyle}" FontSize="12" >
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <cal:ActionMessage MethodName="AutoCompleteBoxSelectionChanged">
                            <cal:Parameter Value="{Binding SelectedItem, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:RadAutoCompleteBox}}}"></cal:Parameter>
                        </cal:ActionMessage>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <i:Interaction.Behaviors>
                    <behaviours:RadAutoCompleteBoxBehavior/>
                </i:Interaction.Behaviors>
            </tbcontrols:SmartSearchRadAutoCompleteBox>
            <Button x:Name="SearchButton" Grid.Column="1"
DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType=controls:APTPanel}}"
                    Click="SearchButton_Click">                
                <Button.Visibility>
                        <con:ConverterBindableBinding Binding="{Binding IsSearchAccountVisible,UpdateSourceTrigger=PropertyChanged}" 
                                                      Converter="{StaticResource BooleanToVisibilityConverter}"
                                                      ConverterParameterBinding="{Binding IsSearchAccountVisible, RelativeSource={RelativeSource AncestorType={x:Type controls:APTPanel}}, UpdateSourceTrigger=PropertyChanged}">
                        </con:ConverterBindableBinding>
                    </Button.Visibility>
            </Button>
        </Grid>
    </DataTemplate>
</telerik:GridViewDataColumn.CellEditTemplate>

If I click the "SearchButton" on first click the event does not fire, the click event fires if I click it second time.
If I remove the SmartSearchRadAutoCompleteBox  control & only keep the SearchButton then it works ok.

Can someone give me code snippet having multiple controls (one radautosearchbox & one button) in datatemplate of celledittemplate or help me understand what is causing issue in my  Click event

Regards,
Swapnil. 

swapnil
Top achievements
Rank 1
 updated question on 19 Mar 2024
1 answer
28 views

Hello. 
I want to add Custom User control to RadDocument in RadRichTextBox. So I use InlineUiContainer to do that. And add it to paragraph.

And it looks so that I have to define height and width to make it so that it will take correct space in the document layout. If I skip this step then it looks like it takes zero width and height.
Looks strange. Because of course I don't know physical size of element in advance. As workaround I can do some "magic" with Loaded event and extract size of UiElement once it was rendered. And it works. But definitely it looks like a dirty code. 
I believe I miss something. Please help me. What am I doing wrong here? :)

By the way when I need to add InlineUiElement  to standard WPF RichTextBox it does all calculations of size by itself.

Dimitar
Telerik team
 answered on 28 Feb 2024
2 answers
29 views

As you can see in the picture the button just gets cut. It only does this if the hight is less than 38

<Grid.RowDefinitions><RowDefinition Height="Auto"/><RowDefinition Height="70"/><RowDefinition Height="*"/></Grid.RowDefinitions><Grid Grid.Row="1" > <telerik:RadDropDownButton HorizontalAlignment="Right" Margin="0,0,20,10" Background="#EFEFEF" Padding="5,0,0,0" Height="24" BorderThickness="1" BorderBrush="LightGray" CornerRadius="5" telerik:StyleManager.Theme="Windows11" > <telerik:RadDropDownButton.Content>


Dimitar
Telerik team
 answered on 22 Jan 2024
0 answers
21 views

Hi,

Is there a way for a telerik radbutton to only show the image that's chosen for a button? 

Opacity is at 100% yet i am still seeing the actual button outline and grey fill/background around my buttons.

See below image.

Thanks

 

Yves
Top achievements
Rank 1
 asked on 04 Jan 2024
1 answer
22 views

I have a RadBusyIndicator and inside it I have several other controls; the structure is bit complex and there are several DB operations are performed in that and while performing that DB operations we are setting IsBusy property of RadBusyIndicator as per progress to true and false. But after invoking this property keyboard focus is shifted to the main window which is not the correct behavior. 

I want my focus on the current control from where I am calling some commands, and it is doing some DB operations.

I have gone through the below solution, but it is not much helpful in my case because the structure of my code is bit complex and I don't want BusyIndication invoked every five seconds as mentioned in this link - "how to restore the focus"

Any help regarding this is much appreciated.

Dimitar
Telerik team
 answered on 15 Dec 2023
0 answers
34 views
hello
I am Korean, so please understand that I wrote this in translation.

[inquiry]
As the title suggests, there is a problem with my source code and it cannot be resolved.

I am coding in MVVM method.

1. Enter TEXT in “ChangeDetails” [Cell] of [Grid View]
2. When executing the event of “PgmUpCommand”
3. “ChangeDetails” does not lose focus, and the bound “ChangeDetails” value cannot be retrieved.
4. After doing number 1, click another [Cell] in the [Grid] and execute number 2 to get the “ChangeDetails” value normally.

I would appreciate it if you could tell me the solution.

Below is the source

<telerik:RadGridView x:Name="dataGrid1" Grid.Column="1" IsReadOnly="False"
ItemsSource="{Binding PgmInfoList}"
SelectedItem="{Binding SelectedPgmInfoItem, Mode=TwoWay}" Margin="239,27,-0.2,-0.4" Grid.RowSpan="2" Grid.ColumnSpan="3" >
<i:Interaction.Behaviors>
<behaviors:GridViewBehavior UseSummaryInfo="False" ShowFooterInfo="False"/>
</i:Interaction.Behaviors>
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
   <prism:InvokeCommandAction Command="{Binding GroupDetailLoadedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="CellEditEnded">
   <prism:InvokeCommandAction Command="{Binding CellEditEndedCommand}" />
</i:EventTrigger>
<i:EventTrigger EventName="SelectedCellsChanged">
   <prism:InvokeCommandAction Command="{Binding PgmInfoSelectedCellChangedCommand}"/>
</i:EventTrigger>
<i:EventTrigger EventName="RowEditEnded">
   <prism:InvokeCommandAction Command="{Binding RowEditEndedCommand}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<telerik:RadGridView.ColumnGroups>
<telerik:GridViewColumnGroup Name="Division" Header="" />
<telerik:GridViewColumnGroup Name="Regist" Header="{Binding [WRD_RegistChangeHistory], Source={StaticResource DRes}}" />
<telerik:GridViewColumnGroup Name="Upload" Header="{Binding [WRD_UploadPGMfile], Source={StaticResource DRes}}" />
</telerik:RadGridView.ColumnGroups>
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding ChangeDetails, Mode=TwoWay}" IsReadOnlyBinding="{Binding Path=IsEnableReadOnly, Mode=TwoWay}"
                                    Header="{Binding [WRD_ChangeHistory1], Source={StaticResource DRes}}"
                                HeaderCellStyle="{StaticResource GridViewHeaderRowStyleBV}"
                                ColumnGroupName="Regist"/>
        <telerik:GridViewDataColumn Header="{Binding [WRD_UP], Source={StaticResource DRes}}" ColumnGroupName="Upload" HeaderCellStyle="{StaticResource GridViewHeaderRowStyleB}">
            <telerik:GridViewDataColumn.CellTemplate>
                <DataTemplate>
                    <Button
                                Command="{Binding DataContext.PgmUpCommand,  RelativeSource={RelativeSource Mode=FindAncestor, AncestorLevel=1, AncestorType={x:Type telerik:RadGridView}}}"
                                CommandParameter="{Binding}"
                                Content="..." IsEnabled="{Binding PgmUpisEnabled}"/>
                </DataTemplate>
            </telerik:GridViewDataColumn.CellTemplate>
        </telerik:GridViewDataColumn>
    </telerik:RadGridView.Columns>
</telerik:RadGridView>


son
Top achievements
Rank 1
 asked on 07 Nov 2023
0 answers
41 views
I use the Windows8Touch Theme and the StyleManager (so the binaries with XAML) to style my Telerik app.  I also follow the Telerik instrructions on how to apply the theme to standard Microsoft controls, like `System.Windows.Controls.Button`

    https://docs.telerik.com/devtools/wpf/styling-and-appearance/how-to/styling-apperance-themes-mscontrols

I use this technique to style the generic Button control and it works well.  Here is the relevant line in my default Button style

        <Setter Property="telerik:StyleManager.Theme" Value="Windows8Touch"/>


But now I have a case in which I want to give my button a transparent background but otherwise have it use the Telerik theming.  This seems like it would be easy:  Just set the `Background` property to `{x:Static Brushes.Transparent}` and it should work fine, right?

And that does look great.  Right up until I push the button.  When I push it, the background changes from transparent to... my default app background.  I want it to stay transparentd

Is there a simple property I can set or a style change I can make to achieve this.  I would prefer to avoid having to write a ControlTemplate for the button.

When I looked at the Telerik XAML, it appeared that I might be able to set a property like `mat:MaterialAssist.PressedBrush`

        <Setter Property="mat:MaterialAssist.PressedBrush" Value="Transparent"/>


or perhaps use `ThemeHelper.SetPressedBackgroundBrush` to achieve what I want


            `ThemeHelper.SetPressedBackgroundBrush(button, Brushes.Transparent);`


but neither of those two attempts made any difference.
Joe
Top achievements
Rank 2
Iron
Iron
Veteran
 asked on 27 Oct 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Dominik
Top achievements
Rank 1
Giuliano
Top achievements
Rank 1
Dominic
Top achievements
Rank 1
Glendys
Top achievements
Rank 1
NoobMaster
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?