Telerik Forums
UI for WPF Forum
2 answers
303 views

Hello,
when I try to open the DropDownContent of a RadDropDownButton in code behind then the DropDownContent is not shown after change visibility of the RadDropDown Button from collapsed to visible.

See following code example:

    <StackPanel>
    <telerik:RadDropDownButton
                                               DropDownPlacement="Bottom"
                  Visibility="Collapsed"
                  x:Name="btnDropDown"
                  Margin="0 0 0 5" Padding="0" Content="Some Header">
        <telerik:RadDropDownButton.DropDownContent>
            <ListBox Background="LightGoldenrodYellow" >
                <ListBoxItem Content="Item 1" />
                <ListBoxItem Content="Item 2"/>
                <ListBoxItem Content="Item 3" />
            </ListBox>
        </telerik:RadDropDownButton.DropDownContent>
    </telerik:RadDropDownButton>
 
    <Button Click="Button_Click">Show ListBox in DropDownButton</Button>
</StackPanel>

in code behind:

private void Button_Click(object sender, RoutedEventArgs e)
{
    btnDropDown.SetCurrentValue(VisibilityProperty, Visibility.Visible);
    btnDropDown.SetCurrentValue(RadDropDownButton.IsOpenProperty, true);
}

 

Result:

The btnDropDown appears on the window and act like opened but the DropDownContent is not shown.


Martin
Top achievements
Rank 1
 answered on 24 Feb 2021
3 answers
226 views

  <telerik:RadTreeListView.ChildTableDefinitions>
                <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
            </telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:RadTreeListView.Columns>
                <telerik:GridViewDataColumn DataMemberBinding="{Binding Path=Item.Name}" Header="Name" SortMemberPath="Item.Name" DataType="{x:Type sys:String}"  />

            </telerik:RadTreeListView.Columns>

    public class Node
    { 
        public object Item { get; set; }

        //public WarehouseItem Item { get; set; } this line works fine

        public ObservableCollection<Node> Children { get; set; } = new ObservableCollection<Node>();
    }

 

If my Node.Item is object or dynamic type, sorting and filtering do not work, if it is a specific entity type like WarehouseItem they works fine.

The same thing happens to RadGridView.

Dilyan Traykov
Telerik team
 answered on 24 Feb 2021
11 answers
193 views

Hello,

I ran into a crash when updating the Docking.for.Xaml nuget to the latest stable 2021.1.119 version. This doesn't crash in the previous stable 2020.3.1020 version.

Steps to reproduce: create a .NET Core (did not try with .NET Framework because my actual program uses Core) WPF solution in Visual Studio, copy the PaneGroupExtensions class from https://github.com/telerik/xaml-sdk/blob/master/Docking/PaneGroupItemsSource/PaneGroupExtensions.cs and fix the namespace, and also around lines 48-55 don't bother with content or datacontext for the pane. The important thing just is to create a pane and added to the Group.Items collection. Add the Docking nuget package to the project. Then create a simple ViewModel class for your MainWindow with an collection property named "ForExtension" and set it as the DataContext for the MainWindow.

public class MainWindowViewModel {
    public List<string> ForExtension { get; set; } = new List<string>() { "Hello" };
}

 

Then add the following simple RadDocking inside your MainWindow.xamls Grid:

<telerik:RadDocking HasDocumentHost="False">
            <telerik:RadSplitContainer>
                <telerik:RadPaneGroup >
                    <telerik:RadPane Header="Pane" IsPinned="False" CanUserClose="False" CanFloat="False">
                        <Grid>
                        </Grid>
                    </telerik:RadPane>
                </telerik:RadPaneGroup>
                <telerik:RadPaneGroup local:PaneGroupExtensions.ItemsSource="{Binding ForExtension}" />
            </telerik:RadSplitContainer>
        </telerik:RadDocking>

 

 

When running this program under either version, it starts fine and displays the UI. When clicking on the pane in the left, the newer version of the nuget crashes the program with a System.NullReferenceException, with a call stack of 

Exception Info: System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Windows.Automation.Peers.AutomationPeer.EnsureChildren()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateChildrenInternal(Int32 invalidateLimit)
   at System.Windows.Automation.Peers.ItemsControlAutomationPeer.UpdateChildren()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
   at System.Windows.ContextLayoutManager.fireAutomationEvents()
   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)
--- End of stack trace from previous location where exception was thrown ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   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.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run()
   at RadGrid2021.App.Main()
Olivier
Top achievements
Rank 1
 answered on 24 Feb 2021
3 answers
206 views

Hi

 

I tried the dark Fluent style for RadTreeView but it didn't work well.

where is the problem from?

Look at the pictures

Vicky
Telerik team
 answered on 24 Feb 2021
5 answers
302 views

Hi,

a simple question. 

I work with no-xaml dll's applying a theme choosed by user dinamically.

Now, I have simple forms with caption/control list.

When the control receive the focus I want apply to relatative caption (that is a textblock) a different foreground.

A good ipothesys is to apply current AccentHighBrush but I don't know the current theme.

Another idea is set a style in code-bihind for the textblock when control is focused and remove style wen focus lost.

But, wath style I can apply to textblock?

Other ideas?

marc.

 

Dilyan Traykov
Telerik team
 answered on 22 Feb 2021
4 answers
446 views
Hello !
I want to Edit Numeric Values with 2 digits in an GridView.

My First Solution:
Using an GridViewDataColumn and set the CellEditTemplate to a
RadMaskedNumericInput like this (SelectionOnFocus="SelectAll" (Important!))
<telerik:GridViewDataColumn Header="Listenpreis" Width="80" TextAlignment="Right" HeaderTextAlignment="Right"
                            DataMemberBinding="{Binding Path=Listenpreis}" DataFormatString="F2">
  <telerik:GridViewDataColumn.CellEditTemplate>
     <DataTemplate>
        <telerik:RadMaskedNumericInput Margin="0" SelectionOnFocus="SelectAll" HorizontalAlignment="Stretch"
               Value="{Binding Path=Listenpreis, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true, ValidatesOnDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
               SpinMode="None"
               FormatString="n2"/>
     </DataTemplate>
  </telerik:GridViewDataColumn.CellEditTemplate>
</telerik:GridViewDataColumn>
This works well for Editing, but the Enter Key doesn't work as expected to go to the next Row in the same Column.
I can Only change the Column with the Tab Key.

My Second Solution:
Using an GridViewMaskedInputColumn like this:
<telerik:GridViewMaskedInputColumn Header="Listenpreis3" Width="80" TextAlignment="Right" HeaderTextAlignment="Right"
                                   MaskType="Numeric"
                                   DataMemberBinding="{Binding Path=Listenpreis}" DataFormatString="{} {0:N2}"  />

But here i'am missing the 2 Digits Mask on Editing and "SelectAll" on Enter the Cell.

How can i get this working as expected ?
Peter
Top achievements
Rank 2
Iron
Iron
Veteran
 answered on 22 Feb 2021
1 answer
259 views

Hello, i am regulary wondering if there is a recommended way to create a window is: create an usercontrol or create an instance in code-behind? 

The documention gives me the impression that the code-behind is the way to go and the usercontrol is just a work-around, but in most examples the usercontrol method is used.

Or it does not matter at all and one should use the method that fits best at the moment?

 

many greetings :-)

Martin Ivanov
Telerik team
 answered on 22 Feb 2021
2 answers
3.2K+ views

I have a few RadButton controls where I would like a different command to execute if the user "long presses" on the button.

For instance a single simple click would do 1 thing and a long click and hold then release would do something else.

How would I do that?

Datafyer
Top achievements
Rank 1
Veteran
 answered on 18 Feb 2021
1 answer
101 views

Hello

If I update, build and run as usual, I get an error. (2020.3.1221.45 -> 2021.1.215.45)

 

 

 

System.Windows.Markup.XamlParseException'(PresentationFramework.dll)

Cannot find resource named 'CardView_DropDownButton_Foreground_Focused'. Resource names are case sensitive

 

I don't use CardvView. I just update and I get an error.

(My environment is NoXaml and Themes is Window7)

Use Reference : Telerik.Windows.Controls,  Telerik.Windows.Controls.Chart, Telerik.Windows.Controls.Data, Telerik.Windows.Controls.GridView,  Telerik.Windows.Controls.Input,  Telerik.Windows.Controls.Navigation, Telerik.Windows.Data,

Thnaks.

Vicky
Telerik team
 answered on 18 Feb 2021
2 answers
170 views

I have a gridview with a databound datetime column in it.

I can change its dataformatstring (or stringformat in binding) so that it shows the date in a short format (dd-mm-yyyy in dutch).

However, when those cells merge, it changes its format to include the time. This means I have a lot of cells that show something like '1-1-2021 00:00:00'.

How can I change that stringformat as well? I could only find a property called contentstringformat, which doesnt do anything.

 

mark
Top achievements
Rank 1
 answered on 18 Feb 2021
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?